ansible-mysql/tasks/slave/replication.yml

24 lines
702 B
YAML

---
- name: MYSQL_REPLICATION | Stop slave
mysql_replication: mode=stopslave
- name: MYSQL_REPLICATION | Configure master host
mysql_replication: >
mode=changemaster
master_host={{ mysql_replication_host }}
master_port={{ mysql_replication_port }}
master_user={{ mysql_replication_user }}
master_password={{ mysql_replication_password }}
- name: MYSQL_REPLICATION | Change master
mysql_replication: >
mode=changemaster
master_log_file={{ mysql_master_log_file }}
master_log_pos={{ mysql_master_log_pos }}
when: mysql_master_log_file is defined and mysql_master_log_pos is defined
- name: MYSQL_REPLICATION | Start slave
mysql_replication: mode=startslave