Merge "Use the utility host for db setup tasks"

This commit is contained in:
Zuul 2020-08-21 15:56:05 +00:00 committed by Gerrit Code Review
commit de902a0ba8
3 changed files with 20 additions and 4 deletions

View File

@ -142,12 +142,14 @@ ironic_automated_clean: false
ironic_erase_devices_priority: 10
# Database
ironic_db_setup_host: "{{ ('galera_all' in groups) | ternary(groups['galera_all'][0], 'localhost') }}"
ironic_db_setup_host: "{{ openstack_db_setup_host | default('localhost') }}"
ironic_db_setup_python_interpreter: "{{ openstack_db_setup_python_interpreter | default((ironic_db_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_python['executable'])) }}"
ironic_galera_address: "{{ galera_address | default('127.0.0.1') }}"
ironic_galera_user: ironic
ironic_galera_database: ironic
ironic_galera_use_ssl: "{{ galera_use_ssl | default(False) }}"
ironic_galera_ssl_ca_cert: "{{ galera_ssl_ca_cert | default('/etc/ssl/certs/galera-ca.pem') }}"
ironic_galera_port: 3306
## Keystone authentication middleware
ironic_keystone_auth_plugin: password
@ -167,7 +169,7 @@ ironic_default_network_interface: "{{ (ironic_neutron_provisioning_network_uuid
ironic_auth_strategy: keystone
ironic_dhcp_provider: "{{ (ironic_standalone | bool) | ternary('none', 'neutron') }}"
ironic_sync_power_state_interval: "{{ (ironic_standalone | bool) | ternary('-1', '60') }}"
ironic_db_connection_string: "mysql+pymysql://{{ ironic_galera_user }}:{{ ironic_container_mysql_password }}@{{ ironic_galera_address }}/ironic{% if ironic_galera_use_ssl | bool %}&ssl_ca={{ ironic_galera_ssl_ca_cert }}{% endif %}"
ironic_db_connection_string: "mysql+pymysql://{{ ironic_galera_user }}:{{ ironic_container_mysql_password }}@{{ ironic_galera_address }}:{{ ironic_galera_port }}/ironic{% if ironic_galera_use_ssl | bool %}&ssl_ca={{ ironic_galera_ssl_ca_cert }}{% endif %}"
# Ironic db tuning
ironic_db_max_overflow: 10
@ -304,10 +306,12 @@ ironic_inspector_service_in_ldap: False
ironic_inspector_service_domain_id: default
# Database
ironic_inspector_db_setup_host: "{{ ('galera_all' in groups) | ternary(groups['galera_all'][0], 'localhost') }}"
ironic_inspector_db_setup_host: "{{ openstack_db_setup_host | default('localhost') }}"
ironic_inspector_db_setup_python_interpreter: "{{ openstack_db_setup_python_interpreter | default((ironic_inspector_db_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_python['executable'])) }}"
ironic_inspector_galera_address: "{{ galera_address | default('127.0.0.1') }}"
ironic_inspector_galera_user: ironic-inspector
ironic_inspector_galera_database: ironic_inspector
ironic_inspector_galera_port: 3306
# Ironic db tuning
ironic_inspector_db_max_overflow: 10
@ -329,7 +333,7 @@ ironic_inspector_swift_role_names:
# Ironic inspector
ironic_inspector_enable_discovery: True
ironic_inspector_openstack_db_connection_string: "mysql+pymysql://{{ ironic_inspector_galera_user }}:{{ ironic_inspector_container_mysql_password }}@{{ ironic_inspector_galera_address }}/{{ ironic_inspector_galera_database }}"
ironic_inspector_openstack_db_connection_string: "mysql+pymysql://{{ ironic_inspector_galera_user }}:{{ ironic_inspector_container_mysql_password }}@{{ ironic_inspector_galera_address }}:{{ ironic_inspector_galera_port }}/{{ ironic_inspector_galera_database }}"
# Ironic inspector dhcp
ironic_inspector_dhcp_pool_range: 192.168.0.51 192.168.0.150

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

@ -30,6 +30,9 @@
- "inventory_hostname == ((groups[ironic_services['ironic-api']['group']]| intersect(ansible_play_hosts)) | list)[0]"
vars:
_oslodb_setup_host: "{{ ironic_db_setup_host }}"
_oslodb_ansible_python_interpreter: "{{ ironic_db_setup_python_interpreter }}"
_oslodb_setup_endpoint: "{{ ironic_galera_address }}"
_oslodb_setup_port: "{{ ironic_galera_port }}"
_oslodb_databases:
- name: "{{ ironic_galera_database }}"
users:
@ -45,6 +48,9 @@
- "inventory_hostname == ((groups[ironic_services['ironic-inspector']['group']]| intersect(ansible_play_hosts)) | list)[0]"
vars:
_oslodb_setup_host: "{{ ironic_inspector_db_setup_host }}"
_oslodb_ansible_python_interpreter: "{{ ironic_inspector_db_setup_python_interpreter }}"
_oslodb_setup_endpoint: "{{ ironic_inspector_galera_address }}"
_oslodb_setup_port: "{{ ironic_inspector_galera_port }}"
_oslodb_databases:
- name: "{{ ironic_inspector_galera_database }}"
users: