From c5500bdfd23d4b89470ea81ffd8e2c2c5a4087d3 Mon Sep 17 00:00:00 2001 From: Michal Arbet Date: Tue, 30 Aug 2022 14:56:48 +0200 Subject: [PATCH] Fix creation of prometheus user and grant permissions Prometheus is creating user and granting permissions to database from which is gathering metrics. This process is different when haproxy/proxysql is used. Proxysql: - kolla-ansible should use root_shard_ID user to connect to ProxySQL endpoint and it is routed to proper shard. Haproxy: - kolla-ansible should use root user to connect to HAProxy endpoint and that's all. If proxysql is not used, mariadb role will not create user shard_root_ID user in bootstrap (from my perspective of view it should), and therefore it will fail when HAProxy is used. This patch is just fixing user to connect. Change-Id: Icd07807b2c404eb4d3f398879639b17f1e7949c2 --- ansible/roles/prometheus/tasks/bootstrap.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ansible/roles/prometheus/tasks/bootstrap.yml b/ansible/roles/prometheus/tasks/bootstrap.yml index 79d847a030..8086169337 100644 --- a/ansible/roles/prometheus/tasks/bootstrap.yml +++ b/ansible/roles/prometheus/tasks/bootstrap.yml @@ -3,7 +3,7 @@ become: true vars: shard_id: "{{ item.key }}" - shard_root_user: "{{ mariadb_shard_root_user_prefix }}{{ shard_id | string }}" + shard_root_user: "{% if mariadb_loadbalancer == 'haproxy' %}{{ database_user }}{% else %}{{ mariadb_shard_root_user_prefix }}{{ shard_id | string }}{% endif %}" shard_host: "{{ mariadb_shards_info.shards[shard_id].hosts[0] }}" kolla_toolbox: module_name: mysql_user @@ -22,6 +22,5 @@ label: "{{ shard_host }}" run_once: True when: - - inventory_hostname == groups['prometheus'][0] - enable_prometheus_mysqld_exporter | bool - not use_preconfigured_databases | bool