The plugin will not generate password files when they are present. I suspect you were running the playbook when the file was not present and it regenerated the password.
This is not a syntax issue. On Sun, Nov 24, 2013 at 4:17 AM, Koen Smets <[email protected]> wrote: > Dear all, > > After re-organising my playbooks using roles and changing > $PASSWORD(credentials/mysql/root) to {{ lookup('password', > 'credentials/mysql/root') }}, I run into troubles configuring mysql. > > # file: ansible-playbooks/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-playbooks/roles/mysql/templates/root-my-cnf.j2 > [client] > user=root > pass={{ lookup('password', 'credentials/mysql/root') }} > > I didn't expect any change after the reorganization, but although both > mysql_user and template action use the same lookup, they access different > files: > - template: as expected, ansible-playbooks/credentials/mysql/root and uses > old password > - mysql_user: ansible-playbooks/roles/mysql/files/credentials/mysql/root > and generates new (and different) password > > Note that ansible-playbooks/roles/mysql/files exists and contains other > files, but credentials didn't exist before running the playbook. > > Quick and dirty workarounds would be to rely on either (obsolete) > $PASSWORD-syntax, or create symlinks roles/mysql/files/credentials to > ../../../credentials, or use absolute paths. None of these solutions seem > elegant, so I'm looking for a proper solution. > > Any ideas how to make sure the top-level credentials files is accessed by > both mysql_user and template actions? > > Kind regards, > Koen > > -- > You received this message because you are subscribed to the Google Groups > "Ansible Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > -- Michael DeHaan <[email protected]> CTO, AnsibleWorks, Inc. http://www.ansibleworks.com/ -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
