diff --git a/defaults/main.yml b/defaults/main.yml index ff8fe5d..aab2786 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -93,12 +93,14 @@ tacker_optional_oslomsg_amqp1_pip_packages: - oslo.messaging[amqp1] ## Database info -tacker_db_setup_host: "{{ ('galera_all' in groups) | ternary(groups['galera_all'][0], 'localhost') }}" +tacker_db_setup_host: "{{ openstack_db_setup_host | default('localhost') }}" +tacker_db_setup_python_interpreter: "{{ openstack_db_setup_python_interpreter | default((tacker_db_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_python['executable'])) }}" tacker_galera_address: "{{ galera_address | default('127.0.0.1') }}" tacker_galera_database: tacker tacker_galera_user: tacker tacker_galera_use_ssl: "{{ galera_use_ssl | default(False) }}" tacker_galera_ssl_ca_cert: "{{ galera_ssl_ca_cert | default('/etc/ssl/certs/galera-ca.pem') }}" +tacker_galera_port: 3306 tacker_role_name: admin tacker_bind_address: "{{ openstack_service_bind_address | default('0.0.0.0') }}" diff --git a/tasks/db_setup.yml b/tasks/db_setup.yml index 7a0120d..aca206e 100644 --- a/tasks/db_setup.yml +++ b/tasks/db_setup.yml @@ -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 diff --git a/tasks/main.yml b/tasks/main.yml index 52b6fa3..23aea3c 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -32,6 +32,9 @@ - inventory_hostname == groups['tacker_all'][0] vars: _oslodb_setup_host: "{{ tacker_db_setup_host }}" + _oslodb_ansible_python_interpreter: "{{ tacker_db_setup_python_interpreter }}" + _oslodb_setup_endpoint: "{{ tacker_galera_address }}" + _oslodb_setup_port: "{{ tacker_galera_port }}" _oslodb_databases: - name: "{{ tacker_galera_database }}" users: