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: I4f469df19bb371b0d38a6438a05054cd21152abd
This commit is contained in:
parent
e64fb69561
commit
653aeffecf
@ -87,14 +87,16 @@ trove_git_constraints:
|
||||
- "--constraint {{ trove_upper_constraints_url }}"
|
||||
|
||||
# Database vars
|
||||
trove_db_setup_host: "{{ ('galera_all' in groups) | ternary(groups['galera_all'][0], 'localhost') }}"
|
||||
trove_db_setup_host: "{{ openstack_db_setup_host | default('localhost') }}"
|
||||
trove_db_setup_python_interpreter: "{{ openstack_db_setup_python_interpreter | default((trove_db_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_python['executable'])) }}"
|
||||
trove_galera_address: "{{ galera_address | default('127.0.0.1') }}"
|
||||
trove_galera_database_name: trove
|
||||
trove_galera_user: trove
|
||||
trove_db_sync_options:
|
||||
trove_galera_use_ssl: "{{ galera_use_ssl | default(False) }}"
|
||||
trove_galera_ssl_ca_cert: "{{ galera_ssl_ca_cert | default('/etc/ssl/certs/galera-ca.pem') }}"
|
||||
trove_galera_connection_string: "mysql+pymysql://{{ trove_galera_user}}:{{ trove_galera_password }}@{{ trove_galera_address }}/{{ trove_galera_database_name }}?charset=utf8{% if trove_galera_use_ssl | bool %}&ssl_ca={{ trove_galera_ssl_ca_cert }}{% endif %}"
|
||||
trove_galera_port: 3306
|
||||
trove_galera_connection_string: "mysql+pymysql://{{ trove_galera_user}}:{{ trove_galera_password }}@{{ trove_galera_address }}:{{ trove_galera_port }}/{{ trove_galera_database_name }}?charset=utf8{% if trove_galera_use_ssl | bool %}&ssl_ca={{ trove_galera_ssl_ca_cert }}{% endif %}"
|
||||
|
||||
## Oslo Messaging vars
|
||||
# RPC
|
||||
|
@ -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
|
||||
|
@ -41,6 +41,9 @@
|
||||
- "inventory_hostname == ((groups[trove_services['trove-api']['group']]| intersect(ansible_play_hosts)) | list)[0]"
|
||||
vars:
|
||||
_oslodb_setup_host: "{{ trove_db_setup_host }}"
|
||||
_oslodb_ansible_python_interpreter: "{{ trove_db_setup_python_interpreter }}"
|
||||
_oslodb_setup_endpoint: "{{ trove_galera_address }}"
|
||||
_oslodb_setup_port: "{{ trove_galera_port }}"
|
||||
_oslodb_databases:
|
||||
- name: "{{ trove_galera_database_name }}"
|
||||
users:
|
||||
|
Loading…
x
Reference in New Issue
Block a user