I do this (in this order):
- name: set password
mysql_user: name={{ mysql_user }} password={{ hostvars[product + '_' +
inventory_hostname + '_' + mysql_user].password }}
- name: create client config
template: src=client.my.cnf dest=~/.my.cnf mode=0600
client.my.cnf:
[client]
user={{ mysql_user }}
password={{ hostvars[product + '_' + inventory_hostname + '_' +
mysql_user].password
}}
By using .my.cnf with [client]-config you would have the login information
to the database on the server (for example in /root/.my.cnf with 600). The
variable for the password is just an example from my inventory..
--
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].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/990a1aa1-c794-4bdb-90a3-19c2339adab2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.