Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Commit

Permalink
Merge "Undercloud mysql database must be idempotent" into stable/train
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and openstack-gerrit committed Apr 19, 2022
2 parents 34f164d + 200d73c commit ad4985c
Showing 1 changed file with 20 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,19 @@
- 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 \
Expand All @@ -130,20 +142,24 @@
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: "{{ not ((ansible_verbosity | int) >= 2) | 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 \
-p{{ mysql_password.stdout }} -s -N \
-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: "{{ not ((ansible_verbosity | int) >= 2) | bool }}"
Expand Down

0 comments on commit ad4985c

Please sign in to comment.