From 5d171001187cca020c411ba4307ba75136c54f31 Mon Sep 17 00:00:00 2001 From: Michal Arbet Date: Fri, 9 Apr 2021 16:35:36 +0200 Subject: [PATCH] Additional small changes in role/mariadb - Replace hardcoded haproxy monitor user with variable. - Rename mariadb_backup variable to mariadb_backup_possible. - Drop creation of monitor user in handlers as this is now handled in register.yml for good reason. Change-Id: I255a79d36ae18ca42d0befd00b235ca509197db3 --- ansible/roles/mariadb/defaults/main.yml | 2 +- ansible/roles/mariadb/handlers/main.yml | 15 --------------- ansible/roles/mariadb/tasks/backup.yml | 2 +- .../roles/mariadb/templates/wsrep-notify.sh.j2 | 2 +- 4 files changed, 3 insertions(+), 18 deletions(-) diff --git a/ansible/roles/mariadb/defaults/main.yml b/ansible/roles/mariadb/defaults/main.yml index 84a2134dbb..15825a77fa 100644 --- a/ansible/roles/mariadb/defaults/main.yml +++ b/ansible/roles/mariadb/defaults/main.yml @@ -113,7 +113,7 @@ mariadb_backup_host: "{{ groups[mariadb_shard_group][0] }}" mariadb_backup_database_schema: "PERCONA_SCHEMA" mariadb_backup_database_user: "{% if mariadb_loadbalancer == 'haproxy' %}backup{% else %}backup_{{ mariadb_shard_name }}{% endif %}" mariadb_backup_type: "full" -mariadb_backup: "{{ mariadb_loadbalancer != 'haproxy' or inventory_hostname in mariadb_default_database_shard_hosts }}" +mariadb_backup_possible: "{{ mariadb_loadbalancer != 'haproxy' or inventory_hostname in mariadb_default_database_shard_hosts }}" #################### # Clustercheck diff --git a/ansible/roles/mariadb/handlers/main.yml b/ansible/roles/mariadb/handlers/main.yml index ccb10c3110..aa99108c10 100644 --- a/ansible/roles/mariadb/handlers/main.yml +++ b/ansible/roles/mariadb/handlers/main.yml @@ -48,21 +48,6 @@ no_log: true listen: Bootstrap MariaDB cluster -- name: Creating haproxy mysql user - become: true - kolla_toolbox: - module_name: mysql_user - module_args: - login_host: "{{ api_interface_address }}" - login_port: "{{ mariadb_port }}" - login_user: "{{ database_user }}" - login_password: "{{ database_password }}" - name: "{{ mariadb_monitor_user }}" - password: "" - host: "%" - priv: "*.*:USAGE" - listen: Bootstrap MariaDB cluster - - name: Restart MariaDB on existing cluster members include_tasks: 'restart_services.yml' when: diff --git a/ansible/roles/mariadb/tasks/backup.yml b/ansible/roles/mariadb/tasks/backup.yml index 1bd0ca0e37..c57f673fc7 100644 --- a/ansible/roles/mariadb/tasks/backup.yml +++ b/ansible/roles/mariadb/tasks/backup.yml @@ -20,4 +20,4 @@ - "kolla_logs:/var/log/kolla/" when: - inventory_hostname == mariadb_backup_host - - mariadb_backup | bool + - mariadb_backup_possible | bool diff --git a/ansible/roles/mariadb/templates/wsrep-notify.sh.j2 b/ansible/roles/mariadb/templates/wsrep-notify.sh.j2 index ae53574bbe..f5096e9246 100644 --- a/ansible/roles/mariadb/templates/wsrep-notify.sh.j2 +++ b/ansible/roles/mariadb/templates/wsrep-notify.sh.j2 @@ -5,7 +5,7 @@ USER={{ database_user }} PSWD={{ database_password }} HOST={{ api_interface_address }} PORT={{ mariadb_port }} -LB_USER=haproxy +LB_USER={{ mariadb_monitor_user }} ENABLE_LB="UPDATE mysql.user SET User='${LB_USER}' WHERE User='${LB_USER}_blocked';" DISABLE_LB="UPDATE mysql.user SET User='${LB_USER}_blocked' WHERE User='${LB_USER}';"