Undercloud mysql database must be idempotent

Currently, the database backup excludes certain tables because it is
intended do a restorable dump of a Galera cluster, but this does not
apply onm the undercloud database, which does not belong to any cluster.

This patch changes the procedure for taking an undercloud database
backup to get a full one.

Change-Id: I5e2876b3f7ffe2b63584802505a10dd1966be4a0
(cherry picked from commit 7884d62ae8)
This commit is contained in:
Juan Larriba 2022-04-05 12:27:52 +02:00
parent 0bc2994fb0
commit af705d5d94
1 changed files with 19 additions and 4 deletions

View File

@ -121,7 +121,18 @@
- bar_create_recover_image
no_log: "{{ tripleo_backup_and_restore_hide_sensitive_logs | bool }}"
- name: MySQL Grants backup
- name: MySQL BBDDs backup
shell: |
set -o pipefail
{{ tripleo_container_cli }} exec {{ tripleo_backup_and_restore_mysql_container }} bash -c "mysqldump -uroot -p{{ mysql_password.stdout }} --opt --all-databases" > {{ tripleo_backup_and_restore_mysql_backup_file }}
when:
- mysql_password.stderr is defined
- not enabled_galera
tags:
- bar_create_recover_image
no_log: "{{ tripleo_backup_and_restore_hide_sensitive_logs | bool }}"
- name: Galera Grants backup
shell: |
set -o pipefail
{{ tripleo_container_cli }} exec {{ tripleo_backup_and_restore_mysql_container }} bash -c "mysql -uroot \
@ -130,12 +141,14 @@
FROM mysql.user where (length(user) > 0 and \
(Host = 'localhost' or Host='%' or IS_IPV4(Host) or IS_IPV6(Host)))\" | xargs -n1 mysql \
-uroot -p{{ mysql_password.stdout }} -s -N -e | sed 's/$/;/' " > {{ tripleo_backup_and_restore_mysql_grants_file }}
when: mysql_password.stderr is defined
when:
- mysql_password.stderr is defined
- enabled_galera
tags:
- bar_create_recover_image
no_log: "{{ tripleo_backup_and_restore_hide_sensitive_logs | bool }}"
- name: MySQL BBDDs backup
- name: Galera BBDDs backup
shell: |
set -o pipefail
{{ tripleo_container_cli }} exec {{ tripleo_backup_and_restore_mysql_container }} bash -c "mysql -uroot \
@ -143,7 +156,9 @@
-e \"select distinct table_schema from information_schema.tables \
where engine='innodb' and table_schema != 'mysql';\" | xargs mysqldump -uroot \
-p{{ mysql_password.stdout }} --single-transaction --databases" > {{ tripleo_backup_and_restore_mysql_backup_file }}
when: mysql_password.stderr is defined
when:
- mysql_password.stderr is defined
- enabled_galera
tags:
- bar_create_recover_image
no_log: "{{ tripleo_backup_and_restore_hide_sensitive_logs | bool }}"