parent
4be27557c7
commit
98237aab2f
|
@ -35,6 +35,14 @@
|
|||
- etc/mysql/mariadb.conf.d/50-mysqld_safe.cnf.j2
|
||||
- etc/mysql/mariadb.conf.d/50-server.cnf.j2
|
||||
|
||||
- name: FILE | Ensure log dir exists
|
||||
ansible.builtin.file:
|
||||
path: "{{ mariadb_slow_query_log_file | dirname }}"
|
||||
state: directory
|
||||
mode: 0755
|
||||
owner: mysql
|
||||
group: mysql
|
||||
|
||||
- name: SERVICE | Restart Mariadb now one at a time (prevent bugs)
|
||||
throttle: 1
|
||||
ansible.builtin.service:
|
||||
|
|
|
@ -25,11 +25,11 @@
|
|||
|
||||
- name: INCLUDE | Import data
|
||||
ansible.builtin.import_tasks: slave/import_data.yml
|
||||
when: (slave_status.failed or not slave_status.Is_Slave) and mariadb_slave_import_data
|
||||
when: (slave_status.failed or not slave_status.Is_Replica) and mariadb_slave_import_data
|
||||
|
||||
- name: Configure GTID Recplication
|
||||
- name: Configure GTID Replication
|
||||
ansible.builtin.import_tasks: slave/gtid.yml
|
||||
when: slave_status.failed or not slave_status.Is_Slave or mariadb_slave_force_setup
|
||||
when: slave_status.failed or not slave_status.Is_Replica or mariadb_slave_force_setup
|
||||
|
||||
- name: MYSQL_REPLICATION | Get slave status
|
||||
community.mysql.mysql_replication:
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
- name: MYSQL_REPLICATION | Stop slave
|
||||
community.mysql.mysql_replication:
|
||||
mode: stopslave
|
||||
mode: stopreplica
|
||||
login_unix_socket: "{{ mariadb_socket }}"
|
||||
|
||||
- name: MYSQL_REPLICATION | Configure master host
|
||||
community.mysql.mysql_replication:
|
||||
mode: changemaster
|
||||
mode: changeprimary
|
||||
master_host: "{{ mariadb_replication_host }}"
|
||||
master_port: "{{ mariadb_replication_port }}"
|
||||
master_user: "{{ mariadb_replication_user }}"
|
||||
|
@ -22,5 +22,5 @@
|
|||
|
||||
- name: MYSQL_REPLICATION | Start slave
|
||||
community.mysql.mysql_replication:
|
||||
mode: startslave
|
||||
mode: startreplica
|
||||
login_unix_socket: "{{ mariadb_socket }}"
|
||||
|
|
|
@ -56,8 +56,8 @@
|
|||
name: "{{ mariadb_service_name }}"
|
||||
state: stopped
|
||||
|
||||
- name: COMMAND | Sync backup to slave - TODO remove vagrant as static user (see why mariadb_backup_user is not working)
|
||||
ansible.builtin.command: "sudo -E rsync --rsync-path='sudo rsync' -a -e 'ssh -o StrictHostKeyChecking=no' {{ mariadb_backup_user }}@{{ mariadb_slave_import_from }}:{{ mariadb_backup_dir }}/ {{ mariadb_datadir }}/"
|
||||
- name: COMMAND | Sync backup to slave
|
||||
ansible.builtin.command: "sudo -E rsync --rsync-path='sudo rsync' --delete -a -e 'ssh -o StrictHostKeyChecking=no' {{ mariadb_backup_user }}@{{ mariadb_slave_import_from }}:{{ mariadb_backup_dir }}/ {{ mariadb_datadir }}/"
|
||||
become: false
|
||||
tags:
|
||||
- skip_ansible_lint
|
||||
|
@ -71,12 +71,6 @@
|
|||
group: mysql
|
||||
recurse: true
|
||||
|
||||
- name: SHELL | Remove InnoDB redo logs
|
||||
ansible.builtin.shell: "rm -f {{ mariadb_datadir }}/ib_logfile*"
|
||||
args:
|
||||
removes: "{{ mariadb_datadir }}/ib_logfile0"
|
||||
warn: false
|
||||
|
||||
- name: SERVICE | Start MariaDB
|
||||
ansible.builtin.service:
|
||||
name: "{{ mariadb_service_name }}"
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
---
|
||||
|
||||
- name: MYSQL_REPLICATION | Stop slave
|
||||
community.mysql.mysql_replication:
|
||||
mode: stopslave
|
||||
login_unix_socket: "{{ mariadb_socket }}"
|
||||
|
||||
- name: MYSQL_REPLICATION | Configure master host
|
||||
community.mysql.mysql_replication:
|
||||
mode: changemaster
|
||||
master_host: "{{ mariadb_replication_host }}"
|
||||
master_port: "{{ mariadb_replication_port }}"
|
||||
master_user: "{{ mariadb_replication_user }}"
|
||||
master_password: "{{ mariadb_replication_password }}"
|
||||
login_unix_socket: "{{ mariadb_socket }}"
|
||||
no_log: "{{ not mariadb_debug_role }}"
|
||||
|
||||
- name: MYSQL_REPLICATION | Change master
|
||||
community.mysql.mysql_replication:
|
||||
mode: changemaster
|
||||
master_log_file: "{{ mariadb_master_log_file }}"
|
||||
master_log_pos: "{{ mariadb_master_log_pos }}"
|
||||
login_unix_socket: "{{ mariadb_socket }}"
|
||||
when: mariadb_master_log_file is defined and mariadb_master_log_pos is defined
|
||||
|
||||
- name: MYSQL_REPLICATION | Start slave
|
||||
community.mysql.mysql_replication:
|
||||
mode: startslave
|
||||
login_unix_socket: "{{ mariadb_socket }}"
|
Loading…
Reference in New Issue