Update 'tasks/mysql-conf.yml'

This commit is contained in:
Tommaso Piccioli 2021-10-14 14:45:15 +02:00
parent 3a3932c64b
commit c68b5d3963
1 changed files with 14 additions and 2 deletions

View File

@ -1,6 +1,14 @@
---
- name: Manage the MySQL configuration files
block:
- name: Check if the new mysql data directory exists
stat: path={{ mysql_data_dir }}
register: my_data_dir
- name: Stop the mysql service while reconfiguring the data directory
service: name=mysql state=stopped
when: my_data_dir.stat.isdir is not defined
- name: Create the data directory
file: dest={{ mysql_data_dir }} state=directory owner=mysql group=mysql mode=0700
@ -20,5 +28,9 @@
- server
notify: Restart mysql
- name: Start the mysql service with the new the data directory
service: name=mysql state=stopped
when: my_data_dir.stat.isdir is not defined
when: mysql_enabled | bool
tags: [ 'mysql', 'mariadb', 'mysql_conf' ]