🐛 Fix ansible mysql calls

due to wokes changes...
pull/46/head
Emilien Mantel 2024-08-26 14:47:03 +02:00
parent 5841e55a45
commit be00c762a6
5 changed files with 16 additions and 43 deletions

View File

@ -35,6 +35,14 @@
- etc/mysql/mariadb.conf.d/50-mysqld_safe.cnf.j2 - etc/mysql/mariadb.conf.d/50-mysqld_safe.cnf.j2
- etc/mysql/mariadb.conf.d/50-server.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) - name: SERVICE | Restart Mariadb now one at a time (prevent bugs)
throttle: 1 throttle: 1
ansible.builtin.service: ansible.builtin.service:

View File

@ -25,11 +25,11 @@
- name: INCLUDE | Import data - name: INCLUDE | Import data
ansible.builtin.import_tasks: slave/import_data.yml 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 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 - name: MYSQL_REPLICATION | Get slave status
community.mysql.mysql_replication: community.mysql.mysql_replication:

View File

@ -2,12 +2,12 @@
- name: MYSQL_REPLICATION | Stop slave - name: MYSQL_REPLICATION | Stop slave
community.mysql.mysql_replication: community.mysql.mysql_replication:
mode: stopslave mode: stopreplica
login_unix_socket: "{{ mariadb_socket }}" login_unix_socket: "{{ mariadb_socket }}"
- name: MYSQL_REPLICATION | Configure master host - name: MYSQL_REPLICATION | Configure master host
community.mysql.mysql_replication: community.mysql.mysql_replication:
mode: changemaster mode: changeprimary
master_host: "{{ mariadb_replication_host }}" master_host: "{{ mariadb_replication_host }}"
master_port: "{{ mariadb_replication_port }}" master_port: "{{ mariadb_replication_port }}"
master_user: "{{ mariadb_replication_user }}" master_user: "{{ mariadb_replication_user }}"
@ -22,5 +22,5 @@
- name: MYSQL_REPLICATION | Start slave - name: MYSQL_REPLICATION | Start slave
community.mysql.mysql_replication: community.mysql.mysql_replication:
mode: startslave mode: startreplica
login_unix_socket: "{{ mariadb_socket }}" login_unix_socket: "{{ mariadb_socket }}"

View File

@ -56,8 +56,8 @@
name: "{{ mariadb_service_name }}" name: "{{ mariadb_service_name }}"
state: stopped state: stopped
- name: COMMAND | Sync backup to slave - TODO remove vagrant as static user (see why mariadb_backup_user is not working) - name: COMMAND | Sync backup to slave
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 }}/" 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 become: false
tags: tags:
- skip_ansible_lint - skip_ansible_lint
@ -71,12 +71,6 @@
group: mysql group: mysql
recurse: true 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 - name: SERVICE | Start MariaDB
ansible.builtin.service: ansible.builtin.service:
name: "{{ mariadb_service_name }}" name: "{{ mariadb_service_name }}"

View File

@ -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 }}"