39 lines
1.1 KiB
YAML
39 lines
1.1 KiB
YAML
---
|
|
|
|
- name: MYSQL_VARIABLES | Set read only
|
|
mysql_variables: variable=read_only value=ON
|
|
when: mysql_slave_readonly
|
|
|
|
- name: TEMPLATE | Deploy slave configuration
|
|
template: src=../templates/etc/mysql/conf.d/51-slave.cnf.j2 dest=/etc/mysql/conf.d/51-slave.cnf
|
|
notify: restart mysql
|
|
|
|
- name: MYSQL_REPLICATION | Get slave status
|
|
mysql_replication: mode=getslave
|
|
ignore_errors: yes
|
|
register: slave_status
|
|
|
|
- name: INCLUDE | Import data
|
|
include: slave/import_data.yml
|
|
when: slave_status.failed is defined and mysql_slave_import_data
|
|
|
|
- name: INCLUDE | Configure replication
|
|
include: slave/replication.yml
|
|
when: slave_status.failed is defined or mysql_slave_force_setup
|
|
|
|
- name: INCLUDE | Transfert /etc/mysql/debian.cnf from master
|
|
include: slave/debiancnf.yml
|
|
when: mysql_slave_replicate_mysqldb
|
|
|
|
- name: MYSQL_REPLICATION | Get slave status
|
|
mysql_replication: mode=getslave
|
|
ignore_errors: yes
|
|
register: slave_status
|
|
|
|
- name: Configure MariaDB GTID
|
|
include: slave/mariadb_gtid.yml
|
|
when: >
|
|
mysql_vendor == 'mariadb' and
|
|
slave_status.Using_Gtid == 'No' and
|
|
mysql_gtid
|