I was having the same issue. I'm using the same playbook as the stackoverflow link you provided, the only thing I updated from it to make it work for me was moving the task that writes "/root/.my.cnf" before the task that updates the root password for all accounts.
This is how my playbook looks like... - name: ensure mysql is running and starts on boot service: name=mysql state=started enabled=true - name: copy .my.cnf file with root password credentials template: src=root-my-cnf.j2 dest=/root/.my.cnf owner=root mode=0600 # 'localhost' needs to be the last item for idempotency, see # http://ansible.cc/docs/modules.html#mysql-user - name: update mysql root password for all root accounts mysql_user: name=root host={{ item }} password={{ mysql_root_password }} priv=*.*:ALL,GRANT with_items: - "{{ ansible_hostname }}" - 127.0.0.1 - ::1 - localhost - name: ensure anonymous users are not in the database mysql_user: name='' host={{ item }} state=absent with_items: - "{{ ansible_hostname }}" - 127.0.0.1 - ::1 - localhost - name: remove the test database mysql_db: name=test state=absent El domingo, 5 de enero de 2014 04:44:08 UTC-6, Sjors Buitenhuis escribió: > > Hi, > > I'm having a very hard time making my MySQL playbook idemptotent on my > vagrant dev machine. I came across two posts from Lorin Hochstein, but > unfortunately i'm still getting the error 'msg: unable to connect to > database, check login_user and login_password are correct or ~/.my.cnf has > the credentials' after running the playbook. > > At this point I'm clueless on how to proceed since my MySQL playbook is > (almost) exactly the same like the one proposed in the SO answer at the > link below. > > - https://coderwall.com/p/yez9yw > - > http://stackoverflow.com/questions/16444306/ansible-idempotent-mysql-installation-playbook > > I've uploaded the playbook, together with the Vagrantfile and host file on > github: > https://github.com/SjorsB/Apache-with-Nginx-Reverse-Proxy-Ansible-Playbook > > Any help is greatly appreciated. > > > Regards, > > Sjors > -- 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/e84b65a4-0bc4-4be2-8f29-c3fa705fb229%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
