From f55821b2aac8716885bdadb183b7c4beda6741ce Mon Sep 17 00:00:00 2001 From: thewebists Date: Wed, 15 Oct 2014 15:09:47 +0200 Subject: [PATCH] Change execution order in secure.yml I use this role in a Vagrant dev environment where the /var/lib/mysql dir is persisted between instances of the VMs. This means that there is a scenario where the /root/.my.cnf may not exist while the mysql already does have a root password set. Placing the template task before executing any mysql_user tasks solves this. --- tasks/secure.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tasks/secure.yml b/tasks/secure.yml index f21a60f..1973e50 100644 --- a/tasks/secure.yml +++ b/tasks/secure.yml @@ -1,5 +1,13 @@ # file: mysql/tasks/secure.yml +- name: MySQL | Configure MySql for easy access as root user + template: + src: root_dot_my.cnf.j2 + dest: /root/.my.cnf + owner: root + group: root + mode: 0600 + - name: MySQL | Set the root password. mysql_user: user: root @@ -23,14 +31,6 @@ - localhost when: ansible_hostname == 'localhost' -- name: MySQL | Configure MySql for easy access as root user - template: - src: root_dot_my.cnf.j2 - dest: /root/.my.cnf - owner: root - group: root - mode: 0600 - - name: MySQL | Remove anonymous MySQL server user mysql_user: name: ""