Add proxysql-config role and wrap it in loadbalancer-config role

This patch ads proxysql-config role
which is used for generating users and
rules configuration.

Change-Id: I1fcb0e8040ea55f8f6b8384a56479eabdaf61c33
This commit is contained in:
Michal Arbet 2022-07-28 18:48:21 +02:00
parent 4838591c6c
commit ae7f4ddc3e
3 changed files with 7 additions and 5 deletions

View File

@ -2,3 +2,7 @@
- import_role:
name: haproxy-config
when: haproxy_config_install | bool
- import_role:
name: proxysql-config
when: enable_proxysql | bool

View File

@ -1,5 +1,5 @@
---
proxysql_project_database_shard: "{{ lookup('vars', (kolla_role_name | default(project_name)) + '_database_shard') }}"
proxysql_project_database_shard: "{{ lookup('vars', (kolla_role_name | default(project_name)) + '_database_shard', default=omit) }}"
# NOTE(kevko): Kolla_role_name and replace is used only because of nova-cell
proxysql_project: "{{ kolla_role_name | default(project_name) | replace('_','-') }}"
proxysql_config_users: "{% if proxysql_project_database_shard is defined and proxysql_project_database_shard['users'] is defined %}True{% else %}False{% endif %}"

View File

@ -1,24 +1,22 @@
---
- name: "Copying over {{ proxysql_project }} users config"
- name: "Copying over {{ proxysql_project }} ProxySQL users config"
template:
src: "users.yaml.j2"
dest: "{{ node_config_directory }}/proxysql/users/{{ proxysql_project }}.yaml"
mode: "0660"
become: true
when:
- enable_proxysql | bool
- proxysql_config_users | bool
notify:
- Restart proxysql container
- name: "Copying over {{ proxysql_project }} rules config"
- name: "Copying over {{ proxysql_project }} ProxySQL rules config"
template:
src: "rules.yaml.j2"
dest: "{{ node_config_directory }}/proxysql/rules/{{ proxysql_project }}.yaml"
mode: "0660"
become: true
when:
- enable_proxysql | bool
- proxysql_config_rules | bool
notify:
- Restart proxysql container