diff --git a/tasks/mysql-conf.yml b/tasks/mysql-conf.yml index 68736a4..33f639b 100644 --- a/tasks/mysql-conf.yml +++ b/tasks/mysql-conf.yml @@ -12,6 +12,13 @@ - name: Create the data directory file: dest={{ mysql_data_dir }} state=directory owner=mysql group=mysql mode=0700 + - name: Copy data to the new directory + synchronize: + src: /var/lib/mysql + dest: {{ mysql_data_dir }} + delegate_to: "{{ inventory_hostname }}" + when: my_data_dir.stat.isdir is not defined + - name: Create the log directory file: dest={{ mysql_log_dir }} state=directory owner=mysql group=adm mode=1750 @@ -29,7 +36,7 @@ notify: Restart mysql - name: Start the mysql service with the new the data directory - service: name=mysql state=stopped + service: name=mysql state=started when: my_data_dir.stat.isdir is not defined when: mysql_enabled | bool