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 }}'
|
||||
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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -55,7 +55,6 @@
|
||||
|
||||
- name: Cleaning up bootstrap container
|
||||
docker:
|
||||
tty: True
|
||||
image: "{{ rabbitmq_image_full }}"
|
||||
name: "rabbitmq_bootstrap"
|
||||
state: "absent"
|
||||
|
Loading…
Reference in New Issue
Block a user