Hi,

Question about the location of ~/.my.cnf .  For ansible, would this refer 
to the "become" user's home directory ( which is /root/.my.cnf ), or the 
ansible user's home directory ( such as, during testing, 
/home/vagrant/.my.cnf ) ?

It seems that mysql_user module is looking for the ansible user's home 
directory because I get an error "msg": "unable to connect to database, 
check login_user and login_password are correct or /home/vagrant/.my.cnf 
has the credentials. Exception message: (1045, \"Access denied for user 
'root'@'localhost' (using password: NO)\")"}

which then leads to the next question, what does the copy module consider 
to be ~/.my.cnf ?

- name: create .my.cnf file 
  copy: content="[client]\nuser=root\npassword={{ mysql_root_password }}" 
dest=~/.my.cnf

This places the file in /root/.my.cnf

The copy module and mysql_user module do not interpret the same ~/.my.cnf ? 
   

More information:

In http://docs.ansible.com/ansible/mysql_user_module.html it says "MySQL 
server installs with default login_user of ‘root’ and no password. To 
secure this user as part of an idempotent playbook, you must create at 
least two tasks: the first must change the root user’s password, without 
providing any login_user/login_password details. The second must drop a 
~/.my.cnf file containing the new root credentials. Subsequent runs of the 
playbook will then succeed by reading the new credentials from the file."

-- 
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/8cc3f732-0ac2-46a7-8038-dce40589082f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to