kolla-ansible/ansible/roles/mariadb/tasks/loadbalancer.yml
Ivan Halomi 4ca2d41762 Adding container_engine to kolla_toolbox module
Second part of patchset:
https://review.opendev.org/c/openstack/kolla-ansible/+/799229/
in which was suggested to split patch into smaller ones.

THis change adds container_engine to module parameters
so when we introduce podman, kolla_toolbox can be used
for both engines.

Signed-off-by: Ivan Halomi <i.halomi@partner.samsung.com>
Co-authored-by: Martin Hiner <m.hiner@partner.samsung.com>
Change-Id: Ic2093aa9341a0cb36df8f340cf290d62437504ad
2022-11-04 15:32:30 +01:00

48 lines
1.4 KiB
YAML

---
# NOTE(kevko): We have to ignore errors
# as new deployments have no galera
# running. In that case, user will be created
# in mariadb role.
#
# It doesn't matter that creating monitor user
# is also in the mariadb role.
#
# If user is switching from haproxy to proxysql,
# monitor user has to be created before proxysql
# will start, otherwise proxysql will evaluate
# mariadb backends are down, because no monitor
# user (only old haproxy user without pass).
#
# Creating monitor user in mariadb role is too late.
- name: Ensure mysql monitor user exist
vars:
shard_id: "{{ item.key }}"
host: "{{ mariadb_shards_info.shards[shard_id].hosts[0] }}"
become: true
kolla_toolbox:
container_engine: "{{ kolla_container_engine }}"
module_name: mysql_user
module_args:
login_host: "{{ host }}"
login_port: "{{ mariadb_port }}"
login_user: "{{ database_user }}"
login_password: "{{ database_password }}"
name: "{{ mariadb_monitor_user }}"
password: "{% if enable_proxysql | bool %}{{ mariadb_monitor_password }}{% endif %}"
host: "%"
priv: "*.*:USAGE"
tags: always
with_dict: "{{ mariadb_shards_info.shards }}"
loop_control:
label: "{{ host }}"
failed_when: False
run_once: True
- name: "Configure loadbalancer for {{ project_name }}"
import_role:
name: loadbalancer-config
vars:
project_services: "{{ mariadb_services }}"
tags: always