diff --git a/ansible/roles/cinder/tasks/bootstrap.yml b/ansible/roles/cinder/tasks/bootstrap.yml index b3ef61139e..614420c202 100644 --- a/ansible/roles/cinder/tasks/bootstrap.yml +++ b/ansible/roles/cinder/tasks/bootstrap.yml @@ -7,11 +7,16 @@ login_password='{{ database_password }}' name='{{ cinder_database_name }}'" register: database - changed_when: "{{ database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" + changed_when: "{{ database.stdout.find('localhost | SUCCESS => ') != -1 and + (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" failed_when: database.stdout.split()[2] != 'SUCCESS' run_once: True delegate_to: "{{ groups['cinder-api'][0] }}" +- name: Reading json from variable + set_fact: + database_created: "{{ (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" + - name: Creating Cinder database user and setting permissions command: docker exec -t kolla_ansible /usr/bin/ansible localhost -m mysql_user @@ -24,7 +29,8 @@ priv='{{ cinder_database_name }}.*:ALL' append_privs='yes'" register: database_user_create - changed_when: "{{ database_user_create.stdout.find('localhost | SUCCESS => ') != -1 and (database_user_create.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" + changed_when: "{{ database_user_create.stdout.find('localhost | SUCCESS => ') != -1 and + (database_user_create.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" failed_when: database_user_create.stdout.split()[2] != 'SUCCESS' run_once: True delegate_to: "{{ groups['cinder-api'][0] }}" @@ -49,7 +55,7 @@ KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" run_once: True delegate_to: "{{ groups['cinder-api'][0] }}" - when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed + when: database_created # https://github.com/ansible/ansible-modules-core/pull/1031 - name: Waiting for bootstrap container to exit @@ -58,13 +64,12 @@ register: bootstrap_result run_once: True delegate_to: "{{ groups['cinder-api'][0] }}" - when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed + when: database_created - name: Cleaning up Cinder bootstrap container docker: - tty: True name: bootstrap_cinder image: "{{ cinder_api_image_full }}" state: absent delegate_to: "{{ groups['cinder-api'][0] }}" - when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed + when: database_created diff --git a/ansible/roles/glance/tasks/bootstrap.yml b/ansible/roles/glance/tasks/bootstrap.yml index f080d13efc..6d29fec4bf 100644 --- a/ansible/roles/glance/tasks/bootstrap.yml +++ b/ansible/roles/glance/tasks/bootstrap.yml @@ -8,11 +8,16 @@ login_password='{{ database_password }}' name='{{ glance_database_name }}'" register: database - changed_when: "{{ database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" + changed_when: "{{ database.stdout.find('localhost | SUCCESS => ') != -1 and + (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" failed_when: database.stdout.split()[2] != 'SUCCESS' run_once: True delegate_to: "{{ groups['glance-api'][0] }}" +- name: Reading json from variable + set_fact: + database_created: "{{ (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" + - name: Creating Glance database user and setting permissions command: docker exec -t kolla_ansible /usr/bin/ansible localhost -m mysql_user @@ -25,7 +30,8 @@ priv='{{ glance_database_name }}.*:ALL' append_privs='yes'" register: database_user_create - changed_when: "{{ database_user_create.stdout.find('localhost | SUCCESS => ') != -1 and (database_user_create.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" + changed_when: "{{ database_user_create.stdout.find('localhost | SUCCESS => ') != -1 and + (database_user_create.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" failed_when: database_user_create.stdout.split()[2] != 'SUCCESS' run_once: True delegate_to: "{{ groups['glance-api'][0] }}" @@ -50,7 +56,7 @@ KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" run_once: True delegate_to: "{{ groups['glance-api'][0] }}" - when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed + when: database_created # https://github.com/ansible/ansible-modules-core/pull/1031 - name: Waiting for bootstrap container to exit @@ -59,13 +65,12 @@ run_once: True delegate_to: "{{ groups['glance-api'][0] }}" failed_when: bootstrap_result.stdout != "0" - when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed + when: database_created - name: Cleaning up Glance bootstrap container docker: - tty: True name: bootstrap_glance image: "{{ glance_api_image_full }}" state: absent delegate_to: "{{ groups['glance-api'][0] }}" - when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed + when: database_created diff --git a/ansible/roles/heat/tasks/bootstrap.yml b/ansible/roles/heat/tasks/bootstrap.yml index b14ce94db1..e0ed79efcf 100644 --- a/ansible/roles/heat/tasks/bootstrap.yml +++ b/ansible/roles/heat/tasks/bootstrap.yml @@ -7,11 +7,16 @@ login_password='{{ database_password }}' name='{{ heat_database_name }}'" register: database - changed_when: "{{ database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" + changed_when: "{{ database.stdout.find('localhost | SUCCESS => ') != -1 and + (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" failed_when: database.stdout.split()[2] != 'SUCCESS' run_once: True delegate_to: "{{ groups['heat-api'][0] }}" +- name: Reading json from variable + set_fact: + database_created: "{{ (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" + - name: Creating Heat database user and setting permissions command: docker exec -t kolla_ansible /usr/bin/ansible localhost -m mysql_user @@ -24,7 +29,8 @@ priv='{{ heat_database_name }}.*:ALL' append_privs='yes'" register: database_user_create - changed_when: "{{ database_user_create.stdout.find('localhost | SUCCESS => ') != -1 and (database_user_create.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" + changed_when: "{{ database_user_create.stdout.find('localhost | SUCCESS => ') != -1 and + (database_user_create.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" failed_when: database_user_create.stdout.split()[2] != 'SUCCESS' run_once: True delegate_to: "{{ groups['heat-api'][0] }}" @@ -55,7 +61,7 @@ HEAT_DOMAIN_ADMIN_PASSWORD: "{{ heat_domain_admin_password }}" run_once: True delegate_to: "{{ groups['heat-api'][0] }}" - when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed + when: database_created # https://github.com/ansible/ansible-modules-core/pull/1031 - name: Waiting for bootstrap container to exit @@ -64,13 +70,12 @@ run_once: True failed_when: bootstrap_result.stdout != "0" delegate_to: "{{ groups['heat-api'][0] }}" - when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed + when: database_created - name: Cleaning up Heat boostrap container docker: - tty: True name: bootstrap_heat image: "{{ heat_api_image_full }}" state: absent delegate_to: "{{ groups['heat-api'][0] }}" - when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed + when: database_created diff --git a/ansible/roles/ironic/tasks/bootstrap.yml b/ansible/roles/ironic/tasks/bootstrap.yml index afac4facbf..94f7b572f4 100644 --- a/ansible/roles/ironic/tasks/bootstrap.yml +++ b/ansible/roles/ironic/tasks/bootstrap.yml @@ -8,11 +8,16 @@ login_password='{{ database_password }}' name='{{ ironic_database_name }}'" register: database - changed_when: "{{ database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" + changed_when: "{{ database.stdout.find('localhost | SUCCESS => ') != -1 and + (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" failed_when: database.stdout.split()[2] != 'SUCCESS' run_once: True delegate_to: "{{ groups['ironic-api'][0] }}" +- name: Reading json from variable + set_fact: + database_created: "{{ (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" + - name: Creating Ironic database user and setting permissions command: docker exec -t kolla_ansible /usr/bin/ansible localhost -m mysql_user @@ -26,7 +31,8 @@ priv='{{ ironic_database_name }}.*:ALL' append_privs='yes'" register: database_user_create - changed_when: "{{ database_user_create.stdout.find('localhost | SUCCESS => ') != -1 and (database_user_create.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" + changed_when: "{{ database.stdout.find('localhost | SUCCESS => ') != -1 and + (database_user_create.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" failed_when: database_user_create.stdout.split()[2] != 'SUCCESS' run_once: True delegate_to: "{{ groups['ironic-api'][0] }}" @@ -51,20 +57,19 @@ KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" run_once: True delegate_to: "{{ groups['ironic-api'][0] }}" - when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed + when: database_created # https://github.com/ansible/ansible-modules-core/pull/1031 - name: Waiting for Ironic bootstrap container to exit command: docker wait bootstrap_ironic run_once: True delegate_to: "{{ groups['ironic-api'][0] }}" - when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed + when: database_created - name: Cleaning up boostrap container docker: - tty: True name: bootstrap_ironic image: "{{ ironic_api_image_full }}" state: absent delegate_to: "{{ groups['ironic-api'][0] }}" - when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed + when: database_created diff --git a/ansible/roles/keystone/tasks/bootstrap.yml b/ansible/roles/keystone/tasks/bootstrap.yml index c42f4120ca..37210875d0 100644 --- a/ansible/roles/keystone/tasks/bootstrap.yml +++ b/ansible/roles/keystone/tasks/bootstrap.yml @@ -8,11 +8,16 @@ login_password='{{ database_password }}' name='{{ keystone_database_name }}'" register: database - changed_when: "{{ database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" + changed_when: "{{ database.stdout.find('localhost | SUCCESS => ') != -1 and + (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" failed_when: database.stdout.split()[2] != 'SUCCESS' run_once: True delegate_to: "{{ groups['keystone'][0] }}" +- name: Reading json from variable + set_fact: + database_created: "{{ (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" + - name: Creating Keystone database user and setting permissions command: docker exec -t kolla_ansible /usr/bin/ansible localhost -m mysql_user @@ -26,7 +31,8 @@ priv='{{ keystone_database_name }}.*:ALL' append_privs='yes'" register: database_user_create - changed_when: "{{ database_user_create.stdout.find('localhost | SUCCESS => ') != -1 and (database_user_create.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" + changed_when: "{{ database.stdout.find('localhost | SUCCESS => ') != -1 and + (database_user_create.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" failed_when: database_user_create.stdout.split()[2] != 'SUCCESS' run_once: True delegate_to: "{{ groups['keystone'][0] }}" @@ -58,7 +64,7 @@ OS_URL: "http://{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}:{{ keystone_admin_port }}/v2.0" run_once: True delegate_to: "{{ groups['keystone'][0] }}" - when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed + when: database_created # https://github.com/ansible/ansible-modules-core/pull/1031 - name: Waiting for Keystone bootstrap container to exit @@ -67,13 +73,12 @@ run_once: True failed_when: bootstrap_result.stdout != "0" delegate_to: "{{ groups['keystone'][0] }}" - when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed + when: database_created - name: Cleaning up Keystone bootstrap container docker: - tty: True name: bootstrap_keystone image: "{{ keystone_image_full }}" state: absent delegate_to: "{{ groups['keystone'][0] }}" - when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed + when: database_created diff --git a/ansible/roles/magnum/tasks/bootstrap.yml b/ansible/roles/magnum/tasks/bootstrap.yml index facda5d1fd..48b9267d08 100644 --- a/ansible/roles/magnum/tasks/bootstrap.yml +++ b/ansible/roles/magnum/tasks/bootstrap.yml @@ -7,11 +7,16 @@ login_password='{{ database_password }}' name='{{ magnum_database_name }}'" register: database - changed_when: "{{ database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" + changed_when: "{{ database.stdout.find('localhost | SUCCESS => ') != -1 and + (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" failed_when: database.stdout.split()[2] != 'SUCCESS' run_once: True delegate_to: "{{ groups['magnum-api'][0] }}" +- name: Reading json from variable + set_fact: + database_created: "{{ (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" + - name: Creating Magnum database user and setting permissions command: docker exec -t kolla_ansible /usr/bin/ansible localhost -m mysql_user @@ -24,7 +29,8 @@ priv='{{ magnum_database_name }}.*:ALL' append_privs='yes'" register: database_user_create - changed_when: "{{ database.stdout.find('localhost | SUCCESS => ') != -1 and (database_user_create.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" + changed_when: "{{ database.stdout.find('localhost | SUCCESS => ') != -1 and + (database_user_create.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" failed_when: database_user_create.stdout.split()[2] != 'SUCCESS' run_once: True delegate_to: "{{ groups['magnum-api'][0] }}" @@ -49,7 +55,7 @@ KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" run_once: True delegate_to: "{{ groups['magnum-api'][0] }}" - when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed + when: database_created # https://github.com/ansible/ansible-modules-core/pull/1031 - name: Waiting for bootstrap container to exit @@ -58,7 +64,7 @@ run_once: True failed_when: bootstrap_result.stdout != "0" delegate_to: "{{ groups['magnum-api'][0] }}" - when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed + when: database_created - name: Cleaning up Magnum boostrap container docker: @@ -67,4 +73,4 @@ image: "{{ magnum_api_image_full }}" state: absent delegate_to: "{{ groups['magnum-api'][0] }}" - when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed + when: database_created diff --git a/ansible/roles/murano/tasks/bootstrap.yml b/ansible/roles/murano/tasks/bootstrap.yml index 25d6e52ea2..ce84179acf 100644 --- a/ansible/roles/murano/tasks/bootstrap.yml +++ b/ansible/roles/murano/tasks/bootstrap.yml @@ -8,11 +8,16 @@ login_password='{{ database_password }}' name='{{ murano_database_name }}'" register: database - changed_when: "{{ database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" + changed_when: "{{ database.stdout.find('localhost | SUCCESS => ') != -1 and + (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" failed_when: database.stdout.split()[2] != 'SUCCESS' run_once: True delegate_to: "{{ groups['murano-api'][0] }}" +- name: Reading json from variable + set_fact: + database_created: "{{ (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" + - name: Creating Murano database user and setting permissions command: docker exec -t kolla_ansible /usr/bin/ansible localhost -m mysql_user @@ -25,7 +30,8 @@ priv='{{ murano_database_name }}.*:ALL' append_privs='yes'" register: database_user_create - changed_when: "{{ database_user_create.stdout.find('localhost | SUCCESS => ') != -1 and (database_user_create.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" + changed_when: "{{ database_user_create.stdout.find('localhost | SUCCESS => ') != -1 and + (database_user_create.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" failed_when: database_user_create.stdout.split()[2] != 'SUCCESS' run_once: True delegate_to: "{{ groups['murano-api'][0] }}" @@ -50,20 +56,19 @@ KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" run_once: True delegate_to: "{{ groups['murano-api'][0] }}" - when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed + when: database_created # https://github.com/ansible/ansible-modules-core/pull/1031 - name: Waiting for bootstrap container to exit command: docker wait bootstrap_murano run_once: True delegate_to: "{{ groups['murano-api'][0] }}" - when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed + when: database_created - name: Cleaning up Murano boostrap container docker: - tty: True name: bootstrap_murano image: "{{ murano_api_image_full }}" state: absent delegate_to: "{{ groups['murano-api'][0] }}" - when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed + when: database_created diff --git a/ansible/roles/neutron/tasks/bootstrap.yml b/ansible/roles/neutron/tasks/bootstrap.yml index b11abe5f97..b3707b0a5d 100644 --- a/ansible/roles/neutron/tasks/bootstrap.yml +++ b/ansible/roles/neutron/tasks/bootstrap.yml @@ -7,11 +7,16 @@ login_password='{{ database_password }}' name='{{ neutron_database_name }}'" register: database - changed_when: "{{ database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" + changed_when: "{{ database.stdout.find('localhost | SUCCESS => ') != -1 and + (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" failed_when: database.stdout.split()[2] != 'SUCCESS' run_once: True delegate_to: "{{ groups['neutron-server'][0] }}" +- name: Reading json from variable + set_fact: + database_created: "{{ (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" + - name: Creating Neutron database user and setting permissions command: docker exec -t kolla_ansible /usr/bin/ansible localhost -m mysql_user @@ -24,7 +29,8 @@ priv='{{ neutron_database_name }}.*:ALL' append_privs='yes'" register: database_user_create - changed_when: "{{ database_user_create.stdout.find('localhost | SUCCESS => ') != -1 and (database_user_create.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" + changed_when: "{{ database_user_create.stdout.find('localhost | SUCCESS => ') != -1 and + (database_user_create.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" failed_when: database_user_create.stdout.split()[2] != 'SUCCESS' run_once: True delegate_to: "{{ groups['neutron-server'][0] }}" @@ -49,7 +55,7 @@ KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" run_once: True delegate_to: "{{ groups['neutron-server'][0] }}" - when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed + when: database_created # https://github.com/ansible/ansible-modules-core/pull/1031 - name: Waiting for bootstrap container to exit @@ -58,13 +64,12 @@ run_once: True failed_when: bootstrap_result.stdout != "0" delegate_to: "{{ groups['neutron-server'][0] }}" - when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed + when: database_created - name: Cleaning up Neutron bootstrap container docker: - tty: True name: bootstrap_neutron image: "{{ neutron_server_image_full }}" state: absent delegate_to: "{{ groups['neutron-server'][0] }}" - when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed + when: database_created diff --git a/ansible/roles/nova/tasks/bootstrap.yml b/ansible/roles/nova/tasks/bootstrap.yml index 30a17dfefb..809b5e64ce 100644 --- a/ansible/roles/nova/tasks/bootstrap.yml +++ b/ansible/roles/nova/tasks/bootstrap.yml @@ -7,11 +7,16 @@ login_password='{{ database_password }}' name='{{ nova_database_name }}'" register: database - changed_when: "{{ database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" + changed_when: "{{ database.stdout.find('localhost | SUCCESS => ') != -1 and + (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" failed_when: database.stdout.split()[2] != 'SUCCESS' run_once: True delegate_to: "{{ groups['nova-api'][0] }}" +- name: Reading json from variable + set_fact: + database_created: "{{ (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" + - name: Creating Nova database user and setting permissions command: docker exec -t kolla_ansible /usr/bin/ansible localhost -m mysql_user @@ -24,7 +29,8 @@ priv='{{ nova_database_name }}.*:ALL' append_privs='yes'" register: database_user_create - changed_when: "{{ database_user_create.stdout.find('localhost | SUCCESS => ') != -1 and (database_user_create.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" + changed_when: "{{ database_user_create.stdout.find('localhost | SUCCESS => ') != -1 and + (database_user_create.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" failed_when: database_user_create.stdout.split()[2] != 'SUCCESS' run_once: True delegate_to: "{{ groups['nova-api'][0] }}" @@ -49,7 +55,7 @@ KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" run_once: True delegate_to: "{{ groups['nova-api'][0] }}" - when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed + when: database_created # https://github.com/ansible/ansible-modules-core/pull/1031 - name: Waiting for bootstrap container to exit @@ -58,13 +64,12 @@ run_once: True failed_when: bootstrap_result.stdout != "0" delegate_to: "{{ groups['nova-api'][0] }}" - when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed + when: database_created - name: Cleaning up Nova bootstrap container docker: - tty: True name: bootstrap_nova image: "{{ nova_api_image_full }}" state: absent delegate_to: "{{ groups['nova-api'][0] }}" - when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed + when: database_created diff --git a/ansible/roles/rabbitmq/tasks/bootstrap.yml b/ansible/roles/rabbitmq/tasks/bootstrap.yml index 930f0f7f08..412fee6467 100644 --- a/ansible/roles/rabbitmq/tasks/bootstrap.yml +++ b/ansible/roles/rabbitmq/tasks/bootstrap.yml @@ -55,7 +55,6 @@ - name: Cleaning up bootstrap container docker: - tty: True image: "{{ rabbitmq_image_full }}" name: "rabbitmq_bootstrap" state: "absent"