--- - name: Creating prometheus database user and setting permissions become: true vars: shard_id: "{{ item.key }}" 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: container_engine: "{{ kolla_container_engine }}" module_name: mysql_user module_args: login_host: "{{ database_address }}" login_port: "{{ mariadb_port }}" login_user: "{{ shard_root_user }}" login_password: "{{ database_password }}" name: "{{ prometheus_mysql_exporter_database_user }}" password: "{{ prometheus_mysql_exporter_database_password }}" host: "%" priv: "*.*:PROCESS,SLAVE MONITOR,SELECT" append_privs: "yes" with_dict: "{{ mariadb_shards_info.shards }}" loop_control: label: "{{ shard_host }}" run_once: True when: - enable_prometheus_mysqld_exporter | bool - not use_preconfigured_databases | bool