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: - import_role:
name: haproxy-config name: haproxy-config
when: haproxy_config_install | bool 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 # NOTE(kevko): Kolla_role_name and replace is used only because of nova-cell
proxysql_project: "{{ kolla_role_name | default(project_name) | replace('_','-') }}" 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 %}" 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: template:
src: "users.yaml.j2" src: "users.yaml.j2"
dest: "{{ node_config_directory }}/proxysql/users/{{ proxysql_project }}.yaml" dest: "{{ node_config_directory }}/proxysql/users/{{ proxysql_project }}.yaml"
mode: "0660" mode: "0660"
become: true become: true
when: when:
- enable_proxysql | bool
- proxysql_config_users | bool - proxysql_config_users | bool
notify: notify:
- Restart proxysql container - Restart proxysql container
- name: "Copying over {{ proxysql_project }} rules config" - name: "Copying over {{ proxysql_project }} ProxySQL rules config"
template: template:
src: "rules.yaml.j2" src: "rules.yaml.j2"
dest: "{{ node_config_directory }}/proxysql/rules/{{ proxysql_project }}.yaml" dest: "{{ node_config_directory }}/proxysql/rules/{{ proxysql_project }}.yaml"
mode: "0660" mode: "0660"
become: true become: true
when: when:
- enable_proxysql | bool
- proxysql_config_rules | bool - proxysql_config_rules | bool
notify: notify:
- Restart proxysql container - Restart proxysql container