Update 'tasks/mysql-conf.yml' #1
|
@ -1,24 +1,36 @@
|
||||||
---
|
---
|
||||||
- name: Manage the MySQL configuration files
|
- name: Manage the MySQL configuration files
|
||||||
block:
|
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
|
- name: Create the data directory
|
||||||
file: dest={{ mysql_data_dir }} state=directory owner=mysql group=mysql mode=0700
|
file: dest={{ mysql_data_dir }} state=directory owner=mysql group=mysql mode=0700
|
||||||
|
|
||||||
- name: Create the log directory
|
- name: Create the log directory
|
||||||
file: dest={{ mysql_log_dir }} state=directory owner=mysql group=adm mode=1750
|
file: dest={{ mysql_log_dir }} state=directory owner=mysql group=adm mode=1750
|
||||||
|
|
||||||
- name: Install the main configuration files.
|
- name: Install the main configuration files.
|
||||||
template: src={{ item }}.cnf.j2 dest={{ mysql_conf_dir }}/{{ item }}.cnf owner=root group=root mode=0644
|
template: src={{ item }}.cnf.j2 dest={{ mysql_conf_dir }}/{{ item }}.cnf owner=root group=root mode=0644
|
||||||
with_items:
|
with_items:
|
||||||
- client
|
- client
|
||||||
- mysql-clients
|
- mysql-clients
|
||||||
notify: Restart mysql
|
notify: Restart mysql
|
||||||
|
|
||||||
- name: Install the main configuration files.
|
- name: Install the main configuration files.
|
||||||
template: src={{ item }}.cnf.j2 dest={{ mysql_service_conf_dir }}/mysqld.cnf owner=root group=root mode=0644
|
template: src={{ item }}.cnf.j2 dest={{ mysql_service_conf_dir }}/mysqld.cnf owner=root group=root mode=0644
|
||||||
with_items:
|
with_items:
|
||||||
- server
|
- server
|
||||||
notify: Restart mysql
|
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
|
when: mysql_enabled | bool
|
||||||
tags: [ 'mysql', 'mariadb', 'mysql_conf' ]
|
tags: [ 'mysql', 'mariadb', 'mysql_conf' ]
|
||||||
|
|
Loading…
Reference in New Issue