Fix bootstrap for services

The bootstrap tasks could be started on any node listed in the
site.yml

The issue is that all the tasks must run on the same node, and the
only node that all the tasks can run on is the 'api' node due to
needing to start the bootstrap container which binds in the configs.

delegate_to is required to ensure that the proper node gets the task.

Co-Authored-By: Sam Yaple <sam@yaple.net>
Change-Id: Ica04ab366777a571a92212ac22c482f1881d4ecd
Closes-Bug: #1513598
Related-Bug: #1513439
This commit is contained in:
Hui Kang 2015-11-07 15:11:40 -05:00 committed by Sam Yaple
parent 7f2d46278f
commit 790bf336d5
18 changed files with 82 additions and 90 deletions

View File

@ -10,6 +10,7 @@
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: Creating Cinder database user and setting permissions
command: docker exec -t kolla_ansible /usr/bin/ansible localhost
@ -26,6 +27,7 @@
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] }}"
- name: Starting Cinder bootstrap container
docker:
@ -46,9 +48,8 @@
KOLLA_BOOTSTRAP:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
run_once: True
when:
- database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed
- inventory_hostname in groups['cinder-api']
delegate_to: "{{ groups['cinder-api'][0] }}"
when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed
# https://github.com/ansible/ansible-modules-core/pull/1031
- name: Waiting for bootstrap container to exit
@ -56,9 +57,8 @@
failed_when: bootstrap_result.stdout != "0"
register: bootstrap_result
run_once: True
when:
- database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed
- inventory_hostname in groups['cinder-api']
delegate_to: "{{ groups['cinder-api'][0] }}"
when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed
- name: Cleaning up Cinder bootstrap container
docker:
@ -66,4 +66,5 @@
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

View File

@ -9,10 +9,7 @@
inventory_hostname in groups['cinder-backup']
- include: register.yml
when: inventory_hostname in groups['cinder-api'] or
inventory_hostname in groups['cinder-volume'] or
inventory_hostname in groups['cinder-scheduler'] or
inventory_hostname in groups['cinder-backup']
when: inventory_hostname in groups['cinder-api']
- include: config.yml
when: inventory_hostname in groups['cinder-api'] or
@ -21,10 +18,7 @@
inventory_hostname in groups['cinder-backup']
- include: bootstrap.yml
when: inventory_hostname in groups['cinder-api'] or
inventory_hostname in groups['cinder-volume'] or
inventory_hostname in groups['cinder-scheduler'] or
inventory_hostname in groups['cinder-backup']
when: inventory_hostname in groups['cinder-api']
- include: start.yml
when: inventory_hostname in groups['cinder-api'] or

View File

@ -11,6 +11,7 @@
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: Creating Glance database user and setting permissions
command: docker exec -t kolla_ansible /usr/bin/ansible localhost
@ -27,6 +28,7 @@
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] }}"
- name: Starting Glance bootstrap container
docker:
@ -47,19 +49,17 @@
KOLLA_BOOTSTRAP:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
run_once: True
when:
- database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed
- inventory_hostname in groups['glance-api']
delegate_to: "{{ groups['glance-api'][0] }}"
when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed
# https://github.com/ansible/ansible-modules-core/pull/1031
- name: Waiting for bootstrap container to exit
command: docker wait bootstrap_glance
register: bootstrap_result
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
- inventory_hostname in groups['glance-api']
when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed
- name: Cleaning up Glance bootstrap container
docker:
@ -67,4 +67,5 @@
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

View File

@ -7,16 +7,14 @@
inventory_hostname in groups['glance-registry']
- include: register.yml
when: inventory_hostname in groups['glance-api'] or
inventory_hostname in groups['glance-registry']
when: inventory_hostname in groups['glance-api']
- include: config.yml
when: inventory_hostname in groups['glance-api'] or
inventory_hostname in groups['glance-registry']
- include: bootstrap.yml
when: inventory_hostname in groups['glance-api'] or
inventory_hostname in groups['glance-registry']
when: inventory_hostname in groups['glance-api']
- include: start.yml
when: inventory_hostname in groups['glance-api'] or

View File

@ -10,6 +10,7 @@
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: Creating Heat database user and setting permissions
command: docker exec -t kolla_ansible /usr/bin/ansible localhost
@ -26,6 +27,7 @@
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] }}"
- name: Starting Heat bootstrap container
docker:
@ -52,9 +54,8 @@
OS_PROJECT_NAME: "{{ openstack_auth.project_name }}"
HEAT_DOMAIN_ADMIN_PASSWORD: "{{ heat_domain_admin_password }}"
run_once: True
when:
- database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed
- inventory_hostname in groups['heat-api']
delegate_to: "{{ groups['heat-api'][0] }}"
when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed
# https://github.com/ansible/ansible-modules-core/pull/1031
- name: Waiting for bootstrap container to exit
@ -62,9 +63,8 @@
register: bootstrap_result
run_once: True
failed_when: bootstrap_result.stdout != "0"
when:
- database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed
- inventory_hostname in groups['heat-api']
delegate_to: "{{ groups['heat-api'][0] }}"
when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed
- name: Cleaning up Heat boostrap container
docker:
@ -72,4 +72,5 @@
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

View File

@ -1,8 +1,6 @@
---
- include: register.yml
when: inventory_hostname in groups['heat-api'] or
inventory_hostname in groups['heat-api-cfn'] or
inventory_hostname in groups['heat-engine']
when: inventory_hostname in groups['heat-api']
- include: config.yml
when: inventory_hostname in groups['heat-api'] or
@ -10,9 +8,7 @@
inventory_hostname in groups['heat-engine']
- include: bootstrap.yml
when: inventory_hostname in groups['heat-api'] or
inventory_hostname in groups['heat-api-cfn'] or
inventory_hostname in groups['heat-engine']
when: inventory_hostname in groups['heat-api']
- include: start.yml
when: inventory_hostname in groups['heat-api'] or

View File

@ -11,6 +11,7 @@
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: Creating Ironic database user and setting permissions
command: docker exec -t kolla_ansible /usr/bin/ansible localhost
@ -28,6 +29,7 @@
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['ironic-api'][0] }}"
- name: Starting Ironic bootstrap container
docker:
@ -48,17 +50,15 @@
KOLLA_BOOTSTRAP:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
run_once: True
when:
- database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed
- inventory_hostname in groups['ironic-api']
delegate_to: "{{ groups['ironic-api'][0] }}"
when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed
# 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
when:
- database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed
- inventory_hostname in groups['ironic-api']
delegate_to: "{{ groups['ironic-api'][0] }}"
when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed
- name: Cleaning up boostrap container
docker:
@ -66,4 +66,5 @@
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

View File

@ -1,9 +1,6 @@
---
- include: register.yml
when: inventory_hostname in groups['ironic-api'] or
inventory_hostname in groups['ironic-conductor'] or
inventory_hostname in groups['ironic-discoverd'] or
inventory_hostname in groups['ironic-pxe']
when: inventory_hostname in groups['ironic-api']
- include: config.yml
when: inventory_hostname in groups['ironic-api'] or
@ -12,10 +9,7 @@
inventory_hostname in groups['ironic-pxe']
- include: bootstrap.yml
when: inventory_hostname in groups['ironic-api'] or
inventory_hostname in groups['ironic-conductor'] or
inventory_hostname in groups['ironic-discoverd'] or
inventory_hostname in groups['ironic-pxe']
when: inventory_hostname in groups['ironic-api']
- include: start.yml
when: inventory_hostname in groups['ironic-api'] or

View File

@ -11,6 +11,7 @@
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: Creating Keystone database user and setting permissions
command: docker exec -t kolla_ansible /usr/bin/ansible localhost
@ -28,6 +29,7 @@
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['keystone'][0] }}"
- name: Starting Keystone bootstrap container
docker:
@ -55,6 +57,7 @@
OS_TOKEN: "{{ keystone_admin_token }}"
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
# https://github.com/ansible/ansible-modules-core/pull/1031
@ -63,6 +66,7 @@
register: bootstrap_result
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
- name: Cleaning up Keystone bootstrap container
@ -71,4 +75,5 @@
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

View File

@ -1,6 +1,9 @@
---
- include: config.yml
when: inventory_hostname in groups['keystone']
- include: bootstrap.yml
when: inventory_hostname in groups['keystone']
- include: start.yml
when: inventory_hostname in groups['keystone']

View File

@ -10,6 +10,7 @@
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: Creating Magnum database user and setting permissions
command: docker exec -t kolla_ansible /usr/bin/ansible localhost
@ -26,6 +27,7 @@
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] }}"
- name: Starting Magnum bootstrap container
docker:
@ -46,6 +48,7 @@
KOLLA_BOOTSTRAP:
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
# https://github.com/ansible/ansible-modules-core/pull/1031
@ -54,6 +57,7 @@
register: bootstrap_result
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
- name: Cleaning up Magnum boostrap container
@ -62,4 +66,5 @@
name: bootstrap_magnum
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

View File

@ -1,8 +1,14 @@
---
- include: register.yml
when: inventory_hostname in groups['magnum-api']
- include: config.yml
when: inventory_hostname in groups['magnum-api'] or
inventory_hostname in groups['magnum-conductor']
- include: bootstrap.yml
when: inventory_hostname in groups['magnum-api']
- include: start.yml
when: inventory_hostname in groups['magnum-api'] or
inventory_hostname in groups['magnum-conductor']

View File

@ -11,6 +11,7 @@
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: Creating Murano database user and setting permissions
command: docker exec -t kolla_ansible /usr/bin/ansible localhost
@ -27,6 +28,7 @@
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] }}"
- name: Starting Murano bootstrap container
docker:
@ -47,17 +49,15 @@
KOLLA_BOOTSTRAP:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
run_once: True
when:
- database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed
- inventory_hostname in groups['murano-api']
delegate_to: "{{ groups['murano-api'][0] }}"
when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed
# https://github.com/ansible/ansible-modules-core/pull/1031
- name: Waiting for bootstrap container to exit
command: docker wait bootstrap_murano
run_once: True
when:
- database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed
- inventory_hostname in groups['murano-api']
delegate_to: "{{ groups['murano-api'][0] }}"
when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed
- name: Cleaning up Murano boostrap container
docker:
@ -65,4 +65,5 @@
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

View File

@ -1,15 +1,13 @@
---
- include: register.yml
when: inventory_hostname in groups['murano-api'] or
inventory_hostname in groups['murano-engine']
when: inventory_hostname in groups['murano-api']
- include: config.yml
when: inventory_hostname in groups['murano-api'] or
inventory_hostname in groups['murano-engine']
- include: bootstrap.yml
when: inventory_hostname in groups['murano-api'] or
inventory_hostname in groups['murano-engine']
when: inventory_hostname in groups['murano-api']
- include: start.yml
when: inventory_hostname in groups['murano-api'] or

View File

@ -10,6 +10,7 @@
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: Creating Neutron database user and setting permissions
command: docker exec -t kolla_ansible /usr/bin/ansible localhost
@ -26,6 +27,7 @@
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] }}"
- name: Starting Neutron bootstrap container
docker:
@ -46,9 +48,8 @@
KOLLA_BOOTSTRAP:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
run_once: True
when:
- database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed
- inventory_hostname in groups['neutron-server']
delegate_to: "{{ groups['neutron-server'][0] }}"
when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed
# https://github.com/ansible/ansible-modules-core/pull/1031
- name: Waiting for bootstrap container to exit
@ -56,9 +57,8 @@
register: bootstrap_result
run_once: True
failed_when: bootstrap_result.stdout != "0"
when:
- database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed
- inventory_hostname in groups['neutron-server']
delegate_to: "{{ groups['neutron-server'][0] }}"
when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed
- name: Cleaning up Neutron bootstrap container
docker:
@ -66,4 +66,5 @@
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

View File

@ -3,9 +3,7 @@
- include: ironic-check.yml
- include: register.yml
when: inventory_hostname in groups['compute'] or
inventory_hostname in groups['neutron-agents'] or
inventory_hostname in groups['neutron-server']
when: inventory_hostname in groups['neutron-server']
- include: config.yml
when: inventory_hostname in groups['compute'] or
@ -13,9 +11,7 @@
inventory_hostname in groups['neutron-server']
- include: bootstrap.yml
when: inventory_hostname in groups['compute'] or
inventory_hostname in groups['neutron-agents'] or
inventory_hostname in groups['neutron-server']
when: inventory_hostname in groups['neutron-server']
- include: start.yml
when: inventory_hostname in groups['compute'] or

View File

@ -10,6 +10,7 @@
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: Creating Nova database user and setting permissions
command: docker exec -t kolla_ansible /usr/bin/ansible localhost
@ -26,6 +27,7 @@
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] }}"
- name: Starting Nova bootstrap container
docker:
@ -46,9 +48,8 @@
KOLLA_BOOTSTRAP:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
run_once: True
when:
- database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed
- inventory_hostname in groups['nova-api']
delegate_to: "{{ groups['nova-api'][0] }}"
when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed
# https://github.com/ansible/ansible-modules-core/pull/1031
- name: Waiting for bootstrap container to exit
@ -56,9 +57,8 @@
register: bootstrap_result
run_once: True
failed_when: bootstrap_result.stdout != "0"
when:
- database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed
- inventory_hostname in groups['nova-api']
delegate_to: "{{ groups['nova-api'][0] }}"
when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed
- name: Cleaning up Nova bootstrap container
docker:
@ -66,4 +66,5 @@
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

View File

@ -11,12 +11,7 @@
inventory_hostname in groups['nova-scheduler']
- include: register.yml
when: inventory_hostname in groups['compute'] or
inventory_hostname in groups['nova-api'] or
inventory_hostname in groups['nova-conductor'] or
inventory_hostname in groups['nova-consoleauth'] or
inventory_hostname in groups['nova-novncproxy'] or
inventory_hostname in groups['nova-scheduler']
when: inventory_hostname in groups['nova-api']
- include: config.yml
when: inventory_hostname in groups['compute'] or
@ -27,12 +22,7 @@
inventory_hostname in groups['nova-scheduler']
- include: bootstrap.yml
when: inventory_hostname in groups['compute'] or
inventory_hostname in groups['nova-api'] or
inventory_hostname in groups['nova-conductor'] or
inventory_hostname in groups['nova-consoleauth'] or
inventory_hostname in groups['nova-novncproxy'] or
inventory_hostname in groups['nova-scheduler']
when: inventory_hostname in groups['nova-api']
- include: start.yml
when: inventory_hostname in groups['compute'] or