2015-08-11 15:22:58 +07:00
|
|
|
---
|
|
|
|
|
|
|
|
- name: MYSQL_VARIABLES | Set read only
|
2018-03-18 00:28:56 +07:00
|
|
|
mysql_variables:
|
|
|
|
variable: read_only
|
|
|
|
value: 'ON'
|
2018-03-17 23:28:54 +07:00
|
|
|
when: mariadb_slave_readonly
|
2015-08-11 15:22:58 +07:00
|
|
|
|
|
|
|
- name: TEMPLATE | Deploy slave configuration
|
2018-03-18 00:28:56 +07:00
|
|
|
template:
|
|
|
|
src: etc/mysql/conf.d/51-slave.cnf.j2
|
|
|
|
dest: /etc/mysql/conf.d/51-slave.cnf
|
2018-03-17 23:28:54 +07:00
|
|
|
notify: restart mariadb
|
2015-08-11 15:22:58 +07:00
|
|
|
|
|
|
|
- name: MYSQL_REPLICATION | Get slave status
|
2018-03-18 00:28:56 +07:00
|
|
|
mysql_replication:
|
|
|
|
mode: getslave
|
2015-08-11 15:22:58 +07:00
|
|
|
ignore_errors: yes
|
|
|
|
register: slave_status
|
|
|
|
|
2017-06-28 21:15:44 +07:00
|
|
|
- name: INCLUDE | Transfert /etc/mysql/debian.cnf from master
|
|
|
|
include: slave/ssh.yml
|
2018-03-17 23:28:54 +07:00
|
|
|
when: mariadb_slave_replicate_mysqldb or ((slave_status.failed is defined or not slave_status.Is_Slave) and mariadb_slave_import_data)
|
2017-06-28 21:15:44 +07:00
|
|
|
|
2015-08-11 15:22:58 +07:00
|
|
|
- name: INCLUDE | Import data
|
|
|
|
include: slave/import_data.yml
|
2018-03-17 23:28:54 +07:00
|
|
|
when: (slave_status.failed is defined or not slave_status.Is_Slave) and mariadb_slave_import_data
|
2015-08-11 15:22:58 +07:00
|
|
|
|
|
|
|
- name: INCLUDE | Configure replication
|
|
|
|
include: slave/replication.yml
|
2018-03-17 23:28:54 +07:00
|
|
|
when: (slave_status.failed is defined or not slave_status.Is_Slave) or mariadb_slave_force_setup
|
2015-08-11 15:22:58 +07:00
|
|
|
|
|
|
|
- name: INCLUDE | Transfert /etc/mysql/debian.cnf from master
|
|
|
|
include: slave/debiancnf.yml
|
2018-03-17 23:28:54 +07:00
|
|
|
when: mariadb_slave_replicate_mysqldb
|
2015-08-11 15:22:58 +07:00
|
|
|
|
|
|
|
- name: MYSQL_REPLICATION | Get slave status
|
2018-03-18 00:28:56 +07:00
|
|
|
mysql_replication:
|
|
|
|
mode: getslave
|
2015-08-11 15:22:58 +07:00
|
|
|
ignore_errors: yes
|
|
|
|
register: slave_status
|
|
|
|
|
2018-03-18 00:42:08 +07:00
|
|
|
- name: Configure GTID
|
|
|
|
include: slave/gtid.yml
|