Make the database json variable more readable
Additionally remove tty from the container cleanup docker section. It was added in a sed in a previous patchset by serves no purpose. Change-Id: Ib617870616bca687f72ffaa44b2e9a3a11ef1011 Partially-Implements: blueprint cleanup-playbooks
This commit is contained in:
parent
790bf336d5
commit
970617b80a
@ -7,11 +7,16 @@
|
|||||||
login_password='{{ database_password }}'
|
login_password='{{ database_password }}'
|
||||||
name='{{ cinder_database_name }}'"
|
name='{{ cinder_database_name }}'"
|
||||||
register: database
|
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'
|
failed_when: database.stdout.split()[2] != 'SUCCESS'
|
||||||
run_once: True
|
run_once: True
|
||||||
delegate_to: "{{ groups['cinder-api'][0] }}"
|
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
|
- name: Creating Cinder database user and setting permissions
|
||||||
command: docker exec -t kolla_ansible /usr/bin/ansible localhost
|
command: docker exec -t kolla_ansible /usr/bin/ansible localhost
|
||||||
-m mysql_user
|
-m mysql_user
|
||||||
@ -24,7 +29,8 @@
|
|||||||
priv='{{ cinder_database_name }}.*:ALL'
|
priv='{{ cinder_database_name }}.*:ALL'
|
||||||
append_privs='yes'"
|
append_privs='yes'"
|
||||||
register: database_user_create
|
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'
|
failed_when: database_user_create.stdout.split()[2] != 'SUCCESS'
|
||||||
run_once: True
|
run_once: True
|
||||||
delegate_to: "{{ groups['cinder-api'][0] }}"
|
delegate_to: "{{ groups['cinder-api'][0] }}"
|
||||||
@ -49,7 +55,7 @@
|
|||||||
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
|
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
|
||||||
run_once: True
|
run_once: True
|
||||||
delegate_to: "{{ groups['cinder-api'][0] }}"
|
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
|
# https://github.com/ansible/ansible-modules-core/pull/1031
|
||||||
- name: Waiting for bootstrap container to exit
|
- name: Waiting for bootstrap container to exit
|
||||||
@ -58,13 +64,12 @@
|
|||||||
register: bootstrap_result
|
register: bootstrap_result
|
||||||
run_once: True
|
run_once: True
|
||||||
delegate_to: "{{ groups['cinder-api'][0] }}"
|
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
|
- name: Cleaning up Cinder bootstrap container
|
||||||
docker:
|
docker:
|
||||||
tty: True
|
|
||||||
name: bootstrap_cinder
|
name: bootstrap_cinder
|
||||||
image: "{{ cinder_api_image_full }}"
|
image: "{{ cinder_api_image_full }}"
|
||||||
state: absent
|
state: absent
|
||||||
delegate_to: "{{ groups['cinder-api'][0] }}"
|
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
|
||||||
|
@ -8,11 +8,16 @@
|
|||||||
login_password='{{ database_password }}'
|
login_password='{{ database_password }}'
|
||||||
name='{{ glance_database_name }}'"
|
name='{{ glance_database_name }}'"
|
||||||
register: database
|
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'
|
failed_when: database.stdout.split()[2] != 'SUCCESS'
|
||||||
run_once: True
|
run_once: True
|
||||||
delegate_to: "{{ groups['glance-api'][0] }}"
|
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
|
- name: Creating Glance database user and setting permissions
|
||||||
command: docker exec -t kolla_ansible /usr/bin/ansible localhost
|
command: docker exec -t kolla_ansible /usr/bin/ansible localhost
|
||||||
-m mysql_user
|
-m mysql_user
|
||||||
@ -25,7 +30,8 @@
|
|||||||
priv='{{ glance_database_name }}.*:ALL'
|
priv='{{ glance_database_name }}.*:ALL'
|
||||||
append_privs='yes'"
|
append_privs='yes'"
|
||||||
register: database_user_create
|
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'
|
failed_when: database_user_create.stdout.split()[2] != 'SUCCESS'
|
||||||
run_once: True
|
run_once: True
|
||||||
delegate_to: "{{ groups['glance-api'][0] }}"
|
delegate_to: "{{ groups['glance-api'][0] }}"
|
||||||
@ -50,7 +56,7 @@
|
|||||||
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
|
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
|
||||||
run_once: True
|
run_once: True
|
||||||
delegate_to: "{{ groups['glance-api'][0] }}"
|
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
|
# https://github.com/ansible/ansible-modules-core/pull/1031
|
||||||
- name: Waiting for bootstrap container to exit
|
- name: Waiting for bootstrap container to exit
|
||||||
@ -59,13 +65,12 @@
|
|||||||
run_once: True
|
run_once: True
|
||||||
delegate_to: "{{ groups['glance-api'][0] }}"
|
delegate_to: "{{ groups['glance-api'][0] }}"
|
||||||
failed_when: bootstrap_result.stdout != "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
|
- name: Cleaning up Glance bootstrap container
|
||||||
docker:
|
docker:
|
||||||
tty: True
|
|
||||||
name: bootstrap_glance
|
name: bootstrap_glance
|
||||||
image: "{{ glance_api_image_full }}"
|
image: "{{ glance_api_image_full }}"
|
||||||
state: absent
|
state: absent
|
||||||
delegate_to: "{{ groups['glance-api'][0] }}"
|
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
|
||||||
|
@ -7,11 +7,16 @@
|
|||||||
login_password='{{ database_password }}'
|
login_password='{{ database_password }}'
|
||||||
name='{{ heat_database_name }}'"
|
name='{{ heat_database_name }}'"
|
||||||
register: database
|
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'
|
failed_when: database.stdout.split()[2] != 'SUCCESS'
|
||||||
run_once: True
|
run_once: True
|
||||||
delegate_to: "{{ groups['heat-api'][0] }}"
|
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
|
- name: Creating Heat database user and setting permissions
|
||||||
command: docker exec -t kolla_ansible /usr/bin/ansible localhost
|
command: docker exec -t kolla_ansible /usr/bin/ansible localhost
|
||||||
-m mysql_user
|
-m mysql_user
|
||||||
@ -24,7 +29,8 @@
|
|||||||
priv='{{ heat_database_name }}.*:ALL'
|
priv='{{ heat_database_name }}.*:ALL'
|
||||||
append_privs='yes'"
|
append_privs='yes'"
|
||||||
register: database_user_create
|
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'
|
failed_when: database_user_create.stdout.split()[2] != 'SUCCESS'
|
||||||
run_once: True
|
run_once: True
|
||||||
delegate_to: "{{ groups['heat-api'][0] }}"
|
delegate_to: "{{ groups['heat-api'][0] }}"
|
||||||
@ -55,7 +61,7 @@
|
|||||||
HEAT_DOMAIN_ADMIN_PASSWORD: "{{ heat_domain_admin_password }}"
|
HEAT_DOMAIN_ADMIN_PASSWORD: "{{ heat_domain_admin_password }}"
|
||||||
run_once: True
|
run_once: True
|
||||||
delegate_to: "{{ groups['heat-api'][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
|
||||||
|
|
||||||
# https://github.com/ansible/ansible-modules-core/pull/1031
|
# https://github.com/ansible/ansible-modules-core/pull/1031
|
||||||
- name: Waiting for bootstrap container to exit
|
- name: Waiting for bootstrap container to exit
|
||||||
@ -64,13 +70,12 @@
|
|||||||
run_once: True
|
run_once: True
|
||||||
failed_when: bootstrap_result.stdout != "0"
|
failed_when: bootstrap_result.stdout != "0"
|
||||||
delegate_to: "{{ groups['heat-api'][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
|
- name: Cleaning up Heat boostrap container
|
||||||
docker:
|
docker:
|
||||||
tty: True
|
|
||||||
name: bootstrap_heat
|
name: bootstrap_heat
|
||||||
image: "{{ heat_api_image_full }}"
|
image: "{{ heat_api_image_full }}"
|
||||||
state: absent
|
state: absent
|
||||||
delegate_to: "{{ groups['heat-api'][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
|
||||||
|
@ -8,11 +8,16 @@
|
|||||||
login_password='{{ database_password }}'
|
login_password='{{ database_password }}'
|
||||||
name='{{ ironic_database_name }}'"
|
name='{{ ironic_database_name }}'"
|
||||||
register: database
|
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'
|
failed_when: database.stdout.split()[2] != 'SUCCESS'
|
||||||
run_once: True
|
run_once: True
|
||||||
delegate_to: "{{ groups['ironic-api'][0] }}"
|
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
|
- name: Creating Ironic database user and setting permissions
|
||||||
command: docker exec -t kolla_ansible /usr/bin/ansible localhost
|
command: docker exec -t kolla_ansible /usr/bin/ansible localhost
|
||||||
-m mysql_user
|
-m mysql_user
|
||||||
@ -26,7 +31,8 @@
|
|||||||
priv='{{ ironic_database_name }}.*:ALL'
|
priv='{{ ironic_database_name }}.*:ALL'
|
||||||
append_privs='yes'"
|
append_privs='yes'"
|
||||||
register: database_user_create
|
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'
|
failed_when: database_user_create.stdout.split()[2] != 'SUCCESS'
|
||||||
run_once: True
|
run_once: True
|
||||||
delegate_to: "{{ groups['ironic-api'][0] }}"
|
delegate_to: "{{ groups['ironic-api'][0] }}"
|
||||||
@ -51,20 +57,19 @@
|
|||||||
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
|
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
|
||||||
run_once: True
|
run_once: True
|
||||||
delegate_to: "{{ groups['ironic-api'][0] }}"
|
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
|
# https://github.com/ansible/ansible-modules-core/pull/1031
|
||||||
- name: Waiting for Ironic bootstrap container to exit
|
- name: Waiting for Ironic bootstrap container to exit
|
||||||
command: docker wait bootstrap_ironic
|
command: docker wait bootstrap_ironic
|
||||||
run_once: True
|
run_once: True
|
||||||
delegate_to: "{{ groups['ironic-api'][0] }}"
|
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
|
- name: Cleaning up boostrap container
|
||||||
docker:
|
docker:
|
||||||
tty: True
|
|
||||||
name: bootstrap_ironic
|
name: bootstrap_ironic
|
||||||
image: "{{ ironic_api_image_full }}"
|
image: "{{ ironic_api_image_full }}"
|
||||||
state: absent
|
state: absent
|
||||||
delegate_to: "{{ groups['ironic-api'][0] }}"
|
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
|
||||||
|
@ -8,11 +8,16 @@
|
|||||||
login_password='{{ database_password }}'
|
login_password='{{ database_password }}'
|
||||||
name='{{ keystone_database_name }}'"
|
name='{{ keystone_database_name }}'"
|
||||||
register: database
|
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'
|
failed_when: database.stdout.split()[2] != 'SUCCESS'
|
||||||
run_once: True
|
run_once: True
|
||||||
delegate_to: "{{ groups['keystone'][0] }}"
|
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
|
- name: Creating Keystone database user and setting permissions
|
||||||
command: docker exec -t kolla_ansible /usr/bin/ansible localhost
|
command: docker exec -t kolla_ansible /usr/bin/ansible localhost
|
||||||
-m mysql_user
|
-m mysql_user
|
||||||
@ -26,7 +31,8 @@
|
|||||||
priv='{{ keystone_database_name }}.*:ALL'
|
priv='{{ keystone_database_name }}.*:ALL'
|
||||||
append_privs='yes'"
|
append_privs='yes'"
|
||||||
register: database_user_create
|
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'
|
failed_when: database_user_create.stdout.split()[2] != 'SUCCESS'
|
||||||
run_once: True
|
run_once: True
|
||||||
delegate_to: "{{ groups['keystone'][0] }}"
|
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"
|
OS_URL: "http://{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}:{{ keystone_admin_port }}/v2.0"
|
||||||
run_once: True
|
run_once: True
|
||||||
delegate_to: "{{ groups['keystone'][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
|
||||||
|
|
||||||
# https://github.com/ansible/ansible-modules-core/pull/1031
|
# https://github.com/ansible/ansible-modules-core/pull/1031
|
||||||
- name: Waiting for Keystone bootstrap container to exit
|
- name: Waiting for Keystone bootstrap container to exit
|
||||||
@ -67,13 +73,12 @@
|
|||||||
run_once: True
|
run_once: True
|
||||||
failed_when: bootstrap_result.stdout != "0"
|
failed_when: bootstrap_result.stdout != "0"
|
||||||
delegate_to: "{{ groups['keystone'][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
|
- name: Cleaning up Keystone bootstrap container
|
||||||
docker:
|
docker:
|
||||||
tty: True
|
|
||||||
name: bootstrap_keystone
|
name: bootstrap_keystone
|
||||||
image: "{{ keystone_image_full }}"
|
image: "{{ keystone_image_full }}"
|
||||||
state: absent
|
state: absent
|
||||||
delegate_to: "{{ groups['keystone'][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
|
||||||
|
@ -7,11 +7,16 @@
|
|||||||
login_password='{{ database_password }}'
|
login_password='{{ database_password }}'
|
||||||
name='{{ magnum_database_name }}'"
|
name='{{ magnum_database_name }}'"
|
||||||
register: database
|
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'
|
failed_when: database.stdout.split()[2] != 'SUCCESS'
|
||||||
run_once: True
|
run_once: True
|
||||||
delegate_to: "{{ groups['magnum-api'][0] }}"
|
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
|
- name: Creating Magnum database user and setting permissions
|
||||||
command: docker exec -t kolla_ansible /usr/bin/ansible localhost
|
command: docker exec -t kolla_ansible /usr/bin/ansible localhost
|
||||||
-m mysql_user
|
-m mysql_user
|
||||||
@ -24,7 +29,8 @@
|
|||||||
priv='{{ magnum_database_name }}.*:ALL'
|
priv='{{ magnum_database_name }}.*:ALL'
|
||||||
append_privs='yes'"
|
append_privs='yes'"
|
||||||
register: database_user_create
|
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'
|
failed_when: database_user_create.stdout.split()[2] != 'SUCCESS'
|
||||||
run_once: True
|
run_once: True
|
||||||
delegate_to: "{{ groups['magnum-api'][0] }}"
|
delegate_to: "{{ groups['magnum-api'][0] }}"
|
||||||
@ -49,7 +55,7 @@
|
|||||||
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
|
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
|
||||||
run_once: True
|
run_once: True
|
||||||
delegate_to: "{{ groups['magnum-api'][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
|
||||||
|
|
||||||
# https://github.com/ansible/ansible-modules-core/pull/1031
|
# https://github.com/ansible/ansible-modules-core/pull/1031
|
||||||
- name: Waiting for bootstrap container to exit
|
- name: Waiting for bootstrap container to exit
|
||||||
@ -58,7 +64,7 @@
|
|||||||
run_once: True
|
run_once: True
|
||||||
failed_when: bootstrap_result.stdout != "0"
|
failed_when: bootstrap_result.stdout != "0"
|
||||||
delegate_to: "{{ groups['magnum-api'][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
|
- name: Cleaning up Magnum boostrap container
|
||||||
docker:
|
docker:
|
||||||
@ -67,4 +73,4 @@
|
|||||||
image: "{{ magnum_api_image_full }}"
|
image: "{{ magnum_api_image_full }}"
|
||||||
state: absent
|
state: absent
|
||||||
delegate_to: "{{ groups['magnum-api'][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
|
||||||
|
@ -8,11 +8,16 @@
|
|||||||
login_password='{{ database_password }}'
|
login_password='{{ database_password }}'
|
||||||
name='{{ murano_database_name }}'"
|
name='{{ murano_database_name }}'"
|
||||||
register: database
|
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'
|
failed_when: database.stdout.split()[2] != 'SUCCESS'
|
||||||
run_once: True
|
run_once: True
|
||||||
delegate_to: "{{ groups['murano-api'][0] }}"
|
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
|
- name: Creating Murano database user and setting permissions
|
||||||
command: docker exec -t kolla_ansible /usr/bin/ansible localhost
|
command: docker exec -t kolla_ansible /usr/bin/ansible localhost
|
||||||
-m mysql_user
|
-m mysql_user
|
||||||
@ -25,7 +30,8 @@
|
|||||||
priv='{{ murano_database_name }}.*:ALL'
|
priv='{{ murano_database_name }}.*:ALL'
|
||||||
append_privs='yes'"
|
append_privs='yes'"
|
||||||
register: database_user_create
|
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'
|
failed_when: database_user_create.stdout.split()[2] != 'SUCCESS'
|
||||||
run_once: True
|
run_once: True
|
||||||
delegate_to: "{{ groups['murano-api'][0] }}"
|
delegate_to: "{{ groups['murano-api'][0] }}"
|
||||||
@ -50,20 +56,19 @@
|
|||||||
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
|
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
|
||||||
run_once: True
|
run_once: True
|
||||||
delegate_to: "{{ groups['murano-api'][0] }}"
|
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
|
# https://github.com/ansible/ansible-modules-core/pull/1031
|
||||||
- name: Waiting for bootstrap container to exit
|
- name: Waiting for bootstrap container to exit
|
||||||
command: docker wait bootstrap_murano
|
command: docker wait bootstrap_murano
|
||||||
run_once: True
|
run_once: True
|
||||||
delegate_to: "{{ groups['murano-api'][0] }}"
|
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
|
- name: Cleaning up Murano boostrap container
|
||||||
docker:
|
docker:
|
||||||
tty: True
|
|
||||||
name: bootstrap_murano
|
name: bootstrap_murano
|
||||||
image: "{{ murano_api_image_full }}"
|
image: "{{ murano_api_image_full }}"
|
||||||
state: absent
|
state: absent
|
||||||
delegate_to: "{{ groups['murano-api'][0] }}"
|
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
|
||||||
|
@ -7,11 +7,16 @@
|
|||||||
login_password='{{ database_password }}'
|
login_password='{{ database_password }}'
|
||||||
name='{{ neutron_database_name }}'"
|
name='{{ neutron_database_name }}'"
|
||||||
register: database
|
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'
|
failed_when: database.stdout.split()[2] != 'SUCCESS'
|
||||||
run_once: True
|
run_once: True
|
||||||
delegate_to: "{{ groups['neutron-server'][0] }}"
|
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
|
- name: Creating Neutron database user and setting permissions
|
||||||
command: docker exec -t kolla_ansible /usr/bin/ansible localhost
|
command: docker exec -t kolla_ansible /usr/bin/ansible localhost
|
||||||
-m mysql_user
|
-m mysql_user
|
||||||
@ -24,7 +29,8 @@
|
|||||||
priv='{{ neutron_database_name }}.*:ALL'
|
priv='{{ neutron_database_name }}.*:ALL'
|
||||||
append_privs='yes'"
|
append_privs='yes'"
|
||||||
register: database_user_create
|
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'
|
failed_when: database_user_create.stdout.split()[2] != 'SUCCESS'
|
||||||
run_once: True
|
run_once: True
|
||||||
delegate_to: "{{ groups['neutron-server'][0] }}"
|
delegate_to: "{{ groups['neutron-server'][0] }}"
|
||||||
@ -49,7 +55,7 @@
|
|||||||
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
|
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
|
||||||
run_once: True
|
run_once: True
|
||||||
delegate_to: "{{ groups['neutron-server'][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
|
||||||
|
|
||||||
# https://github.com/ansible/ansible-modules-core/pull/1031
|
# https://github.com/ansible/ansible-modules-core/pull/1031
|
||||||
- name: Waiting for bootstrap container to exit
|
- name: Waiting for bootstrap container to exit
|
||||||
@ -58,13 +64,12 @@
|
|||||||
run_once: True
|
run_once: True
|
||||||
failed_when: bootstrap_result.stdout != "0"
|
failed_when: bootstrap_result.stdout != "0"
|
||||||
delegate_to: "{{ groups['neutron-server'][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
|
- name: Cleaning up Neutron bootstrap container
|
||||||
docker:
|
docker:
|
||||||
tty: True
|
|
||||||
name: bootstrap_neutron
|
name: bootstrap_neutron
|
||||||
image: "{{ neutron_server_image_full }}"
|
image: "{{ neutron_server_image_full }}"
|
||||||
state: absent
|
state: absent
|
||||||
delegate_to: "{{ groups['neutron-server'][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
|
||||||
|
@ -7,11 +7,16 @@
|
|||||||
login_password='{{ database_password }}'
|
login_password='{{ database_password }}'
|
||||||
name='{{ nova_database_name }}'"
|
name='{{ nova_database_name }}'"
|
||||||
register: database
|
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'
|
failed_when: database.stdout.split()[2] != 'SUCCESS'
|
||||||
run_once: True
|
run_once: True
|
||||||
delegate_to: "{{ groups['nova-api'][0] }}"
|
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
|
- name: Creating Nova database user and setting permissions
|
||||||
command: docker exec -t kolla_ansible /usr/bin/ansible localhost
|
command: docker exec -t kolla_ansible /usr/bin/ansible localhost
|
||||||
-m mysql_user
|
-m mysql_user
|
||||||
@ -24,7 +29,8 @@
|
|||||||
priv='{{ nova_database_name }}.*:ALL'
|
priv='{{ nova_database_name }}.*:ALL'
|
||||||
append_privs='yes'"
|
append_privs='yes'"
|
||||||
register: database_user_create
|
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'
|
failed_when: database_user_create.stdout.split()[2] != 'SUCCESS'
|
||||||
run_once: True
|
run_once: True
|
||||||
delegate_to: "{{ groups['nova-api'][0] }}"
|
delegate_to: "{{ groups['nova-api'][0] }}"
|
||||||
@ -49,7 +55,7 @@
|
|||||||
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
|
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
|
||||||
run_once: True
|
run_once: True
|
||||||
delegate_to: "{{ groups['nova-api'][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
|
||||||
|
|
||||||
# https://github.com/ansible/ansible-modules-core/pull/1031
|
# https://github.com/ansible/ansible-modules-core/pull/1031
|
||||||
- name: Waiting for bootstrap container to exit
|
- name: Waiting for bootstrap container to exit
|
||||||
@ -58,13 +64,12 @@
|
|||||||
run_once: True
|
run_once: True
|
||||||
failed_when: bootstrap_result.stdout != "0"
|
failed_when: bootstrap_result.stdout != "0"
|
||||||
delegate_to: "{{ groups['nova-api'][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
|
- name: Cleaning up Nova bootstrap container
|
||||||
docker:
|
docker:
|
||||||
tty: True
|
|
||||||
name: bootstrap_nova
|
name: bootstrap_nova
|
||||||
image: "{{ nova_api_image_full }}"
|
image: "{{ nova_api_image_full }}"
|
||||||
state: absent
|
state: absent
|
||||||
delegate_to: "{{ groups['nova-api'][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
|
||||||
|
@ -55,7 +55,6 @@
|
|||||||
|
|
||||||
- name: Cleaning up bootstrap container
|
- name: Cleaning up bootstrap container
|
||||||
docker:
|
docker:
|
||||||
tty: True
|
|
||||||
image: "{{ rabbitmq_image_full }}"
|
image: "{{ rabbitmq_image_full }}"
|
||||||
name: "rabbitmq_bootstrap"
|
name: "rabbitmq_bootstrap"
|
||||||
state: "absent"
|
state: "absent"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user