# Password lookup issues after re-organising playbooks into roles

**URL:** <https://forum.ansible.com/t/password-lookup-issues-after-re-organising-playbooks-into-roles/13971>\
**Category:** Ansible Project\
**Created:** [November 22, 2013, 10:32am UTC](https://forum.ansible.com/t/password-lookup-issues-after-re-organising-playbooks-into-roles/13971 "2013-11-22T10:32:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Koen\_Smets](https://avatars.discourse-cdn.com/v4/letter/k/5f9b8f/32.png) [@Koen\_Smets](https://forum.ansible.com/u/Koen_Smets)\
**Post date:** [November 22, 2013, 10:32am UTC](https://forum.ansible.com/t/password-lookup-issues-after-re-organising-playbooks-into-roles/13971/1 "2013-11-22T10:32:19Z")

</div>

Dear all,

I started re-organising my playbooks with roles, but stumbled on some password lookup issues.

# file: ansible/roles/mysql/tasks/main.yml

- name: MySQL | Set the root password  
mysql\_user: user=root password=“{{ lookup(‘password’, ‘credentials/mysql/root’) }}” host=localhost

- name: MySQL | Config for easy access as root user  
template: src=root-my-cnf.j2 dest=/root/.my.cnf

# file: ansible/roles/mysql/template/root-my-cnf.j2

[client]  
user=root  
pass={{ lookup(‘password’, ‘credentials/mysql/root’) }}

I stored all my credentials previously in top-level `ansible/credentials/`, and expected running the site.yml playbook with Ansible 1.4 wouldn’t change anything to my database settings.

However:

- the template action correctly and as expected uses the current password from `ansible/credentials/mysql/root`.
- the mysql\_user action generates a new password and writes it into `ansible/roles/mysql/files/credentials/mysql/root`.

(Note: the directory ansible/roles/mysql/files exists and contains other files but didn’t contain the credentials dir before running the site.yml)

Any ideas, besides using absolute paths which I rather not prefer, on how to make both lookups result in using the password in `ansible/credentials/files/mysql/root`?

Kind regards,

Koen

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [November 22, 2013, 9:00pm UTC](https://forum.ansible.com/t/password-lookup-issues-after-re-organising-playbooks-into-roles/13971/2 "2013-11-22T21:00:28Z")

</div>

Please state what the problem is in the above as you don’t specifically call it out.
