From a2c2eba34fb7077346d651918dfb22a53a63cb00 Mon Sep 17 00:00:00 2001 From: Waldemar Znoinski Date: Fri, 6 May 2016 15:51:55 +0100 Subject: [PATCH] add support for non-default database_port in kolla/ansible This change makes each step of the kolla deployment aware of the port database was configured to listen on. It defaults mariadb_port to database_port. Change-Id: I8e85d5732015afc0a5481cb33e0b629fdfa84a1b Closes-Bug: #1576151 DocImpact --- ansible/group_vars/all.yml | 3 ++- ansible/roles/cinder/defaults/main.yml | 2 +- ansible/roles/cinder/tasks/bootstrap.yml | 2 ++ ansible/roles/glance/defaults/main.yml | 2 +- ansible/roles/glance/tasks/bootstrap.yml | 3 ++- ansible/roles/haproxy/tasks/start.yml | 2 +- ansible/roles/heat/defaults/main.yml | 2 +- ansible/roles/heat/tasks/bootstrap.yml | 3 ++- ansible/roles/ironic/defaults/main.yml | 2 +- ansible/roles/ironic/tasks/bootstrap.yml | 4 ++-- ansible/roles/keystone/defaults/main.yml | 2 +- ansible/roles/keystone/tasks/bootstrap.yml | 4 ++-- ansible/roles/magnum/defaults/main.yml | 2 +- ansible/roles/magnum/tasks/bootstrap.yml | 2 ++ ansible/roles/manila/defaults/main.yml | 2 +- ansible/roles/manila/tasks/bootstrap.yml | 2 ++ ansible/roles/mariadb/tasks/check.yml | 2 +- ansible/roles/mistral/defaults/main.yml | 2 +- ansible/roles/mistral/tasks/bootstrap.yml | 3 ++- ansible/roles/murano/defaults/main.yml | 2 +- ansible/roles/murano/tasks/bootstrap.yml | 3 ++- ansible/roles/neutron/defaults/main.yml | 2 +- ansible/roles/neutron/tasks/bootstrap.yml | 2 ++ ansible/roles/nova/defaults/main.yml | 4 ++-- ansible/roles/nova/tasks/bootstrap.yml | 4 ++++ ansible/roles/prechecks/tasks/port_checks.yml | 4 ++-- 26 files changed, 42 insertions(+), 25 deletions(-) diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index ab63645052..c11b39703a 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -38,6 +38,7 @@ kolla_enable_sanity_swift: "{{ kolla_enable_sanity_checks }}" #################### database_address: "{{ kolla_internal_fqdn }}" database_user: "root" +database_port: "3306" #################### @@ -87,7 +88,7 @@ neutron_plugin_agent: "openvswitch" # The default ports used by each service. iscsi_port: "3260" -mariadb_port: "3306" +mariadb_port: "{{ database_port }}" mariadb_wsrep_port: "4567" mariadb_ist_port: "4568" mariadb_sst_port: "4444" diff --git a/ansible/roles/cinder/defaults/main.yml b/ansible/roles/cinder/defaults/main.yml index 99a61803c5..cdcdd4357e 100644 --- a/ansible/roles/cinder/defaults/main.yml +++ b/ansible/roles/cinder/defaults/main.yml @@ -24,7 +24,7 @@ cinder_backup_cache_mode: "{{ ceph_cinder_backup_cache_mode }}" #################### cinder_database_name: "cinder" cinder_database_user: "cinder" -cinder_database_address: "{{ kolla_internal_fqdn }}" +cinder_database_address: "{{ kolla_internal_fqdn }}:{{ database_port }}" #################### diff --git a/ansible/roles/cinder/tasks/bootstrap.yml b/ansible/roles/cinder/tasks/bootstrap.yml index 10418c9732..7762f2892b 100644 --- a/ansible/roles/cinder/tasks/bootstrap.yml +++ b/ansible/roles/cinder/tasks/bootstrap.yml @@ -3,6 +3,7 @@ command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m mysql_db -a "login_host='{{ database_address }}' + login_port='{{ database_port }}' login_user='{{ database_user }}' login_password='{{ database_password }}' name='{{ cinder_database_name }}'" @@ -21,6 +22,7 @@ command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m mysql_user -a "login_host='{{ database_address }}' + login_port='{{ database_port }}' login_user='{{ database_user }}' login_password='{{ database_password }}' name='{{ cinder_database_name }}' diff --git a/ansible/roles/glance/defaults/main.yml b/ansible/roles/glance/defaults/main.yml index 3e35923e89..6a7a5985da 100644 --- a/ansible/roles/glance/defaults/main.yml +++ b/ansible/roles/glance/defaults/main.yml @@ -23,7 +23,7 @@ glance_cache_mode: "{{ ceph_glance_cache_mode }}" #################### glance_database_name: "glance" glance_database_user: "glance" -glance_database_address: "{{ kolla_internal_fqdn }}" +glance_database_address: "{{ kolla_internal_fqdn }}:{{ database_port }}" #################### diff --git a/ansible/roles/glance/tasks/bootstrap.yml b/ansible/roles/glance/tasks/bootstrap.yml index 08c027b673..10d650d926 100644 --- a/ansible/roles/glance/tasks/bootstrap.yml +++ b/ansible/roles/glance/tasks/bootstrap.yml @@ -3,8 +3,8 @@ command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m mysql_db -a "login_host='{{ database_address }}' + login_port='{{ database_port }}' login_user='{{ database_user }}' - login_port='{{ mariadb_port }}' login_password='{{ database_password }}' name='{{ glance_database_name }}'" register: database @@ -22,6 +22,7 @@ command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m mysql_user -a "login_host='{{ database_address }}' + login_port='{{ database_port }}' login_user='{{ database_user }}' login_password='{{ database_password }}' name='{{ glance_database_name }}' diff --git a/ansible/roles/haproxy/tasks/start.yml b/ansible/roles/haproxy/tasks/start.yml index 0909b33b0b..692de8591c 100644 --- a/ansible/roles/haproxy/tasks/start.yml +++ b/ansible/roles/haproxy/tasks/start.yml @@ -34,4 +34,4 @@ - name: Waiting for virtual IP to appear wait_for: host: "{{ kolla_internal_vip_address }}" - port: "{{ mariadb_port }}" + port: "{{ database_port }}" diff --git a/ansible/roles/heat/defaults/main.yml b/ansible/roles/heat/defaults/main.yml index d5e71e0d96..9ceb0a59f6 100644 --- a/ansible/roles/heat/defaults/main.yml +++ b/ansible/roles/heat/defaults/main.yml @@ -6,7 +6,7 @@ project_name: "heat" #################### heat_database_name: "heat" heat_database_user: "heat" -heat_database_address: "{{ kolla_internal_fqdn }}" +heat_database_address: "{{ kolla_internal_fqdn }}:{{ database_port }}" #################### diff --git a/ansible/roles/heat/tasks/bootstrap.yml b/ansible/roles/heat/tasks/bootstrap.yml index 2ac3cfd8c4..50c74920b2 100644 --- a/ansible/roles/heat/tasks/bootstrap.yml +++ b/ansible/roles/heat/tasks/bootstrap.yml @@ -3,8 +3,8 @@ command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m mysql_db -a "login_host='{{ database_address }}' + login_port='{{ database_port }}' login_user='{{ database_user }}' - login_port='{{ mariadb_port }}' login_password='{{ database_password }}' name='{{ heat_database_name }}'" register: database @@ -22,6 +22,7 @@ command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m mysql_user -a "login_host='{{ database_address }}' + login_port='{{ database_port }}' login_user='{{ database_user }}' login_password='{{ database_password }}' name='{{ heat_database_name }}' diff --git a/ansible/roles/ironic/defaults/main.yml b/ansible/roles/ironic/defaults/main.yml index 0301c3d357..1b052ebe10 100644 --- a/ansible/roles/ironic/defaults/main.yml +++ b/ansible/roles/ironic/defaults/main.yml @@ -6,7 +6,7 @@ project_name: "ironic" #################### ironic_database_name: "ironic" ironic_database_user: "ironic" -ironic_database_address: "{{ kolla_internal_fqdn }}" +ironic_database_address: "{{ kolla_internal_fqdn }}:{{ database_port }}" #################### diff --git a/ansible/roles/ironic/tasks/bootstrap.yml b/ansible/roles/ironic/tasks/bootstrap.yml index 1b1ff962c5..54eecc0f0e 100644 --- a/ansible/roles/ironic/tasks/bootstrap.yml +++ b/ansible/roles/ironic/tasks/bootstrap.yml @@ -3,7 +3,7 @@ command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m mysql_db -a "login_host='{{ database_address }}' - login_port='{{ mariadb_port }}' + login_port='{{ database_port }}' login_user='{{ database_user }}' login_password='{{ database_password }}' name='{{ ironic_database_name }}'" @@ -22,7 +22,7 @@ command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m mysql_user -a "login_host='{{ database_address }}' - login_port='{{ mariadb_port }}' + login_port='{{ database_port }}' login_user='{{ database_user }}' login_password='{{ database_password }}' name='{{ ironic_database_name }}' diff --git a/ansible/roles/keystone/defaults/main.yml b/ansible/roles/keystone/defaults/main.yml index 4242903224..a3f559a61c 100644 --- a/ansible/roles/keystone/defaults/main.yml +++ b/ansible/roles/keystone/defaults/main.yml @@ -6,7 +6,7 @@ project_name: "keystone" #################### keystone_database_name: "keystone" keystone_database_user: "keystone" -keystone_database_address: "{{ kolla_internal_fqdn }}" +keystone_database_address: "{{ kolla_internal_fqdn }}:{{ database_port }}" #################### diff --git a/ansible/roles/keystone/tasks/bootstrap.yml b/ansible/roles/keystone/tasks/bootstrap.yml index 1694cdb79d..301933e47c 100644 --- a/ansible/roles/keystone/tasks/bootstrap.yml +++ b/ansible/roles/keystone/tasks/bootstrap.yml @@ -3,7 +3,7 @@ command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m mysql_db -a "login_host='{{ database_address }}' - login_port='{{ mariadb_port }}' + login_port='{{ database_port }}' login_user='{{ database_user }}' login_password='{{ database_password }}' name='{{ keystone_database_name }}'" @@ -22,7 +22,7 @@ command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m mysql_user -a "login_host='{{ database_address }}' - login_port='{{ mariadb_port }}' + login_port='{{ database_port }}' login_user='{{ database_user }}' login_password='{{ database_password }}' name='{{ keystone_database_name }}' diff --git a/ansible/roles/magnum/defaults/main.yml b/ansible/roles/magnum/defaults/main.yml index a3192a8f99..f48fff44f3 100644 --- a/ansible/roles/magnum/defaults/main.yml +++ b/ansible/roles/magnum/defaults/main.yml @@ -6,7 +6,7 @@ project_name: "magnum" #################### magnum_database_name: "magnum" magnum_database_user: "magnum" -magnum_database_address: "{{ kolla_internal_fqdn }}" +magnum_database_address: "{{ kolla_internal_fqdn }}:{{ database_port }}" #################### diff --git a/ansible/roles/magnum/tasks/bootstrap.yml b/ansible/roles/magnum/tasks/bootstrap.yml index bd91c161ba..af9d640fbe 100644 --- a/ansible/roles/magnum/tasks/bootstrap.yml +++ b/ansible/roles/magnum/tasks/bootstrap.yml @@ -3,6 +3,7 @@ command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m mysql_db -a "login_host='{{ database_address }}' + login_port='{{ database_port }}' login_user='{{ database_user }}' login_password='{{ database_password }}' name='{{ magnum_database_name }}'" @@ -21,6 +22,7 @@ command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m mysql_user -a "login_host='{{ database_address }}' + login_port='{{ database_port }}' login_user='{{ database_user }}' login_password='{{ database_password }}' name='{{ magnum_database_name }}' diff --git a/ansible/roles/manila/defaults/main.yml b/ansible/roles/manila/defaults/main.yml index 664f88be03..9f68ef5b26 100644 --- a/ansible/roles/manila/defaults/main.yml +++ b/ansible/roles/manila/defaults/main.yml @@ -6,7 +6,7 @@ project_name: "manila" ##################### manila_database_name: "manila" manila_database_user: "manila" -manila_database_address: "{{ kolla_internal_fqdn }}" +manila_database_address: "{{ kolla_internal_fqdn }}:{{ database_port }}" ##################### diff --git a/ansible/roles/manila/tasks/bootstrap.yml b/ansible/roles/manila/tasks/bootstrap.yml index 31b8600e40..0d51963b0e 100644 --- a/ansible/roles/manila/tasks/bootstrap.yml +++ b/ansible/roles/manila/tasks/bootstrap.yml @@ -3,6 +3,7 @@ command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m mysql_db -a "login_host='{{ database_address }}' + login_port='{{ database_port }}' login_user='{{ database_user }}' login_password='{{ database_password }}' name='{{ manila_database_name }}'" @@ -21,6 +22,7 @@ command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m mysql_user -a "login_host='{{ database_address }}' + login_port='{{ database_port }}' login_user='{{ database_user }}' login_password='{{ database_password }}' name='{{ manila_database_name }}' diff --git a/ansible/roles/mariadb/tasks/check.yml b/ansible/roles/mariadb/tasks/check.yml index 61ff73436d..5389e78aef 100644 --- a/ansible/roles/mariadb/tasks/check.yml +++ b/ansible/roles/mariadb/tasks/check.yml @@ -1,6 +1,6 @@ --- - name: Waiting for MariaDB service to be ready through VIP - command: "docker exec mariadb mysql -h {{ kolla_internal_fqdn }} -u haproxy -e 'show databases;'" + command: "docker exec mariadb mysql -h {{ kolla_internal_fqdn }} -P {{ mariadb_port }} -u haproxy -e 'show databases;'" register: result until: result | success changed_when: False diff --git a/ansible/roles/mistral/defaults/main.yml b/ansible/roles/mistral/defaults/main.yml index 9b3411b100..b1e4eb1809 100644 --- a/ansible/roles/mistral/defaults/main.yml +++ b/ansible/roles/mistral/defaults/main.yml @@ -6,7 +6,7 @@ project_name: "mistral" #################### mistral_database_name: "mistral" mistral_database_user: "mistral" -mistral_database_address: "{{ kolla_internal_fqdn }}" +mistral_database_address: "{{ kolla_internal_fqdn }}:{{ database_port }}" #################### diff --git a/ansible/roles/mistral/tasks/bootstrap.yml b/ansible/roles/mistral/tasks/bootstrap.yml index ff659c026e..10f8a7773f 100644 --- a/ansible/roles/mistral/tasks/bootstrap.yml +++ b/ansible/roles/mistral/tasks/bootstrap.yml @@ -3,8 +3,8 @@ command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m mysql_db -a "login_host='{{ database_address }}' + login_port='{{ database_port }}' login_user='{{ database_user }}' - login_port='{{ mariadb_port }}' login_password='{{ database_password }}' name='{{ mistral_database_name }}'" register: database @@ -22,6 +22,7 @@ command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m mysql_user -a "login_host='{{ database_address }}' + login_port='{{ database_port }}' login_user='{{ database_user }}' login_password='{{ database_password }}' name='{{ mistral_database_name }}' diff --git a/ansible/roles/murano/defaults/main.yml b/ansible/roles/murano/defaults/main.yml index 3292946ab8..50ccef01fa 100644 --- a/ansible/roles/murano/defaults/main.yml +++ b/ansible/roles/murano/defaults/main.yml @@ -6,7 +6,7 @@ project_name: "murano" #################### murano_database_name: "murano" murano_database_user: "murano" -murano_database_address: "{{ kolla_internal_fqdn }}" +murano_database_address: "{{ kolla_internal_fqdn }}:{{ database_port }}" #################### diff --git a/ansible/roles/murano/tasks/bootstrap.yml b/ansible/roles/murano/tasks/bootstrap.yml index 4bd551dcff..931636ee82 100644 --- a/ansible/roles/murano/tasks/bootstrap.yml +++ b/ansible/roles/murano/tasks/bootstrap.yml @@ -3,8 +3,8 @@ command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m mysql_db -a "login_host='{{ database_address }}' + login_port='{{ database_port }}' login_user='{{ database_user }}' - login_port='{{ mariadb_port }}' login_password='{{ database_password }}' name='{{ murano_database_name }}'" register: database @@ -22,6 +22,7 @@ command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m mysql_user -a "login_host='{{ database_address }}' + login_port='{{ database_port }}' login_user='{{ database_user }}' login_password='{{ database_password }}' name='{{ murano_database_name }}' diff --git a/ansible/roles/neutron/defaults/main.yml b/ansible/roles/neutron/defaults/main.yml index a8fc726791..a8660cab1f 100644 --- a/ansible/roles/neutron/defaults/main.yml +++ b/ansible/roles/neutron/defaults/main.yml @@ -6,7 +6,7 @@ project_name: "neutron" #################### neutron_database_name: "neutron" neutron_database_user: "neutron" -neutron_database_address: "{{ kolla_internal_fqdn }}" +neutron_database_address: "{{ kolla_internal_fqdn }}:{{ database_port }}" #################### diff --git a/ansible/roles/neutron/tasks/bootstrap.yml b/ansible/roles/neutron/tasks/bootstrap.yml index 30c9006bde..526743fb93 100644 --- a/ansible/roles/neutron/tasks/bootstrap.yml +++ b/ansible/roles/neutron/tasks/bootstrap.yml @@ -3,6 +3,7 @@ command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m mysql_db -a "login_host='{{ database_address }}' + login_port='{{ database_port }}' login_user='{{ database_user }}' login_password='{{ database_password }}' name='{{ neutron_database_name }}'" @@ -21,6 +22,7 @@ command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m mysql_user -a "login_host='{{ database_address }}' + login_port='{{ database_port }}' login_user='{{ database_user }}' login_password='{{ database_password }}' name='{{ neutron_database_name }}' diff --git a/ansible/roles/nova/defaults/main.yml b/ansible/roles/nova/defaults/main.yml index 7c5a54f151..08a440e294 100644 --- a/ansible/roles/nova/defaults/main.yml +++ b/ansible/roles/nova/defaults/main.yml @@ -19,11 +19,11 @@ nova_cache_mode: "{{ ceph_nova_cache_mode }}" #################### nova_database_name: "nova" nova_database_user: "nova" -nova_database_address: "{{ kolla_internal_fqdn }}" +nova_database_address: "{{ kolla_internal_fqdn }}:{{ database_port }}" nova_api_database_name: "nova_api" nova_api_database_user: "nova_api" -nova_api_database_address: "{{ kolla_internal_fqdn }}" +nova_api_database_address: "{{ kolla_internal_fqdn }}:{{ database_port }}" #################### # Docker diff --git a/ansible/roles/nova/tasks/bootstrap.yml b/ansible/roles/nova/tasks/bootstrap.yml index e7014527cc..dd2222591e 100644 --- a/ansible/roles/nova/tasks/bootstrap.yml +++ b/ansible/roles/nova/tasks/bootstrap.yml @@ -3,6 +3,7 @@ command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m mysql_db -a "login_host='{{ database_address }}' + login_port='{{ database_port }}' login_user='{{ database_user }}' login_password='{{ database_password }}' name='{{ nova_database_name }}'" @@ -21,6 +22,7 @@ command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m mysql_db -a "login_host='{{ database_address }}' + login_port='{{ database_port }}' login_user='{{ database_user }}' login_password='{{ database_password }}' name='{{ nova_api_database_name }}'" @@ -39,6 +41,7 @@ command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m mysql_user -a "login_host='{{ database_address }}' + login_port='{{ database_port }}' login_user='{{ database_user }}' login_password='{{ database_password }}' name='{{ nova_database_name }}' @@ -57,6 +60,7 @@ command: docker exec -t kolla_toolbox /usr/bin/ansible localhost -m mysql_user -a "login_host='{{ database_address }}' + login_port='{{ database_port }}' login_user='{{ database_user }}' login_password='{{ database_password }}' name='{{ nova_api_database_name }}' diff --git a/ansible/roles/prechecks/tasks/port_checks.yml b/ansible/roles/prechecks/tasks/port_checks.yml index 867c65fa1f..73489c402f 100644 --- a/ansible/roles/prechecks/tasks/port_checks.yml +++ b/ansible/roles/prechecks/tasks/port_checks.yml @@ -162,7 +162,7 @@ - name: Checking free port for MariaDB wait_for: host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}" - port: "{{ mariadb_port }}" + port: "{{ database_port }}" connect_timeout: 1 state: stopped when: inventory_hostname in groups['mariadb'] @@ -170,7 +170,7 @@ - name: Checking free port for MariaDB HAProxy wait_for: host: "{{ kolla_internal_vip_address }}" - port: "{{ mariadb_port }}" + port: "{{ database_port }}" connect_timeout: 1 state: stopped when: inventory_hostname in groups['haproxy']