refs #8414 - Rsync to dont´t fail at the end

This commit is contained in:
Xavi Lleó 2025-01-29 09:51:30 +01:00
parent 994447329c
commit d1ec1bc57b
1 changed files with 25 additions and 2 deletions

View File

@ -71,7 +71,7 @@
# mode: u=rw,g=r,o=r
- name: Insert MySQL certificates
#no_log: true
no_log: true
copy:
content: "{{ item.content }}"
dest: "{{ item.dest }}"
@ -104,7 +104,7 @@
- /mnt/local-backup
Make sure they are correctly configured and accessible.
- when: production is false
- when: production is false or production is not defined
block:
- name: Set MariaDB custom configuration Test-DB-DEV
@ -157,3 +157,26 @@
owner: root
group: root
mode: u=rw,g=,o=
- name: Check if /var/lib/mysql/ exists
stat:
path: /var/lib/mysql/
register: mysql_dir
- when: mysql_dir.stat.exists
block:
- name: Sync MySQL data directory
synchronize:
src: /var/lib/mysql/
dest: /mnt/mysqldata/mysql/
archive: true
compress: true
recursive: true
delegate_to: "{{ inventory_hostname }}"
- name: Remove old MySQL data after sync
file:
path: /var/lib/mysql/
state: absent