- 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- 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=absentMight be worth taking a look at the mysql role in Ansible galaxy.
--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.