Merge "Use the utility host for db setup tasks"

This commit is contained in:
Zuul 2020-08-17 18:16:56 +00:00 committed by Gerrit Code Review
commit fe82d21135
3 changed files with 11 additions and 1 deletions

View File

@ -98,7 +98,8 @@ keystone_resource_driver: sql
keystone_bind_address: "{{ openstack_service_bind_address | default('0.0.0.0') }}"
## Database info
keystone_db_setup_host: "{{ ('galera_all' in groups) | ternary(groups['galera_all'][0], 'localhost') }}"
keystone_db_setup_host: "{{ openstack_db_setup_host | default('localhost') }}"
keystone_db_setup_python_interpreter: "{{ openstack_db_setup_python_interpreter | default((keystone_db_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_python['executable'])) }}"
keystone_galera_address: "{{ galera_address | default('127.0.0.1') }}"
keystone_galera_user: keystone
keystone_galera_database: keystone

View File

@ -22,12 +22,16 @@
- name: Setup Database Service (MariaDB)
delegate_to: "{{ _oslodb_setup_host }}"
vars:
ansible_python_interpreter: "{{ _oslodb_ansible_python_interpreter }}"
tags:
- common-mariadb
block:
- name: Create database for service
mysql_db:
name: "{{ item.name }}"
login_host: "{{ _oslodb_setup_endpoint | default(omit) }}"
login_port: "{{ _oslodb_setup_port | default(omit) }}"
loop: "{{ _oslodb_databases }}"
no_log: true
@ -38,5 +42,7 @@
host: "{{ item.1.host | default('%') }}"
priv: "{{ item.0.name }}.*:{{ item.1.priv | default('ALL') }}"
append_privs: yes
login_host: "{{ _oslodb_setup_endpoint | default(omit) }}"
login_port: "{{ _oslodb_setup_port | default(omit) }}"
loop: "{{ _oslodb_databases | subelements('users') }}"
no_log: true

View File

@ -69,6 +69,9 @@
- "inventory_hostname == ((groups[keystone_services['keystone-wsgi-public']['group']] | intersect(ansible_play_hosts)) | list)[0]"
vars:
_oslodb_setup_host: "{{ keystone_db_setup_host }}"
_oslodb_ansible_python_interpreter: "{{ keystone_db_setup_python_interpreter }}"
_oslodb_setup_endpoint: "{{ keystone_galera_address }}"
_oslodb_setup_port: "{{ keystone_galera_port }}"
_oslodb_databases:
- name: "{{ keystone_galera_database }}"
users: