Use the utility host for db setup tasks

Move it to the service setup host (defaults to utility[0]) instead
of the galera[0] host, and use galera_address (defaults to internal VIP)
as the endpoint instead of a local connection on the db host.

Change-Id: Ic4a2dfeeb022e1dbe0b1ba8aa0d0dd5feb7a8ffe
This commit is contained in:
Guilherme Steinmüller 2020-08-19 18:14:34 +00:00
parent 841d6ff7e4
commit 5e52841391
3 changed files with 12 additions and 1 deletions

View File

@ -87,13 +87,15 @@ nova_management_address: "127.0.0.1"
# nova_system_group_gid = <GID> # nova_system_group_gid = <GID>
## Database info ## Database info
nova_db_setup_host: "{{ ('galera_all' in groups) | ternary(groups['galera_all'][0], 'localhost') }}" nova_db_setup_host: "{{ openstack_db_setup_host | default('localhost') }}"
nova_db_setup_python_interpreter: "{{ openstack_db_setup_python_interpreter | default((nova_db_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_python['executable'])) }}"
nova_galera_address: "{{ galera_address | default('127.0.0.1') }}" nova_galera_address: "{{ galera_address | default('127.0.0.1') }}"
nova_galera_user: nova nova_galera_user: nova
nova_galera_database: nova nova_galera_database: nova
nova_db_max_overflow: 10 nova_db_max_overflow: 10
nova_db_max_pool_size: 120 nova_db_max_pool_size: 120
nova_db_pool_timeout: 30 nova_db_pool_timeout: 30
nova_galera_port: 3306
# Toggle whether nova connects via an encrypted connection # Toggle whether nova connects via an encrypted connection
nova_galera_use_ssl: "{{ galera_use_ssl | default(False) }}" nova_galera_use_ssl: "{{ galera_use_ssl | default(False) }}"
# The path where to store the database server CA certificate # The path where to store the database server CA certificate

View File

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

View File

@ -75,6 +75,9 @@
- "inventory_hostname == ((groups[nova_services['nova-conductor']['group']] | intersect(ansible_play_hosts)) | list)[0]" - "inventory_hostname == ((groups[nova_services['nova-conductor']['group']] | intersect(ansible_play_hosts)) | list)[0]"
vars: vars:
_oslodb_setup_host: "{{ nova_db_setup_host }}" _oslodb_setup_host: "{{ nova_db_setup_host }}"
_oslodb_ansible_python_interpreter: "{{ nova_db_setup_python_interpreter }}"
_oslodb_setup_endpoint: "{{ nova_galera_address }}"
_oslodb_setup_port: "{{ nova_galera_port }}"
_oslodb_databases: _oslodb_databases:
- name: "{{ nova_galera_database }}" - name: "{{ nova_galera_database }}"
users: users: