From 8ce7da7a3c52126706c90a2bc27cc41c31b87ece Mon Sep 17 00:00:00 2001 From: Georgina Shippey Date: Wed, 20 Jan 2021 14:13:55 +0000 Subject: [PATCH] Bring db setup vars in line with other roles Allows for galera_db_setup_host to be overridden if necessary for delegation. Brings the format in line with the db_setup vars in other roles. Change-Id: Ie2a802ebb8297bed03d74b3cf54907322b858896 --- defaults/main.yml | 4 ++++ tasks/galera_server_backups.yml | 7 ++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index c1ced755..0650c6ab 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -206,6 +206,10 @@ galera_client_my_cnf_overrides: {} # "galera_server" group and fall back to localhost. galera_ssl_server: "{{ (galera_cluster_members | default(['localhost']))[0] }}" +## Database info +galera_db_setup_host: "{{ openstack_db_setup_host | default(galera_cluster_members[0] | default('localhost')) }}" +galera_db_setup_python_interpreter: "{{ openstack_db_setup_python_interpreter | default((galera_db_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_python['executable'])) }}" + # Configure backups of database # copies is the number of full backups to be kept, the corresponding # incremental backups will also be kept. Uses systemd timer instead of cron. diff --git a/tasks/galera_server_backups.yml b/tasks/galera_server_backups.yml index a8e837ad..b3519f52 100644 --- a/tasks/galera_server_backups.yml +++ b/tasks/galera_server_backups.yml @@ -79,12 +79,9 @@ when: galera_mariadb_backups_increment_on_calendar is defined - name: Grant access to the database for the backup service - delegate_to: "{{ openstack_db_setup_host | default('localhost') }}" + delegate_to: "{{ galera_db_setup_host }}" vars: - galera_db_setup_host: "{{ openstack_db_setup_host | default('localhost') }}" - ansible_python_interpreter: "{{ openstack_db_setup_python_interpreter | - default((galera_db_setup_host == 'localhost') | - ternary(ansible_playbook_python, ansible_python['executable'])) }}" + ansible_python_interpreter: "{{ galera_db_setup_python_interpreter }}" community.mysql.mysql_user: name: "{{ galera_mariadb_backups_user }}" password: "{{ galera_mariadb_backups_password }}"