Check exit status of bootstrap containers

Currently bootstrap containers are waited to exit but are not
checked for exit status and ansible runs further tasks. If
bootstrapping fails we notice it at much later time.

Change-Id: I137fc11b0f9d1f03d2ded08a213e8dbd62741f92
Closes-Bug: #1492337
This commit is contained in:
Vladislav Belogrudov 2015-09-04 19:47:54 +03:00
parent 11cba5fb66
commit 7f81dbc85b
7 changed files with 41 additions and 0 deletions

View File

@ -71,8 +71,14 @@
- name: Waiting for bootstrap container to exit
command: docker wait bootstrap_cinder
when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed
register: bootstrap_result
run_once: True
- name: Checking for bootstrap failures
fail: msg="Bootstrapping failed"
run_once: True
when: bootstrap_result|changed and bootstrap_result.stdout != "0"
- name: Cleaning up Cinder bootstrap container
docker:
name: bootstrap_cinder

View File

@ -70,9 +70,15 @@
# 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
when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed
- name: Checking for bootstrap failures
fail: msg="Bootstrapping failed"
run_once: True
when: bootstrap_result|changed and bootstrap_result.stdout != "0"
- name: Cleaning up Glance bootstrap container
docker:
name: bootstrap_glance

View File

@ -57,9 +57,15 @@
# https://github.com/ansible/ansible-modules-core/pull/1031
- name: Waiting for bootstrap container to exit
command: docker wait bootstrap_heat
register: bootstrap_result
run_once: True
when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed
- name: Checking for bootstrap failures
fail: msg="Bootstrapping failed"
run_once: True
when: bootstrap_result|changed and bootstrap_result.stdout != "0"
- name: Cleaning up Heat boostrap container
docker:
name: bootstrap_heat

View File

@ -60,9 +60,15 @@
# https://github.com/ansible/ansible-modules-core/pull/1031
- name: Waiting for Keystone bootstrap container to exit
command: docker wait bootstrap_keystone
register: bootstrap_result
run_once: True
when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed
- name: Checking for bootstrap failures
fail: msg="Bootstrapping failed"
run_once: True
when: bootstrap_result|changed and bootstrap_result.stdout != "0"
- name: Cleaning up Keystone bootstrap container
docker:
name: bootstrap_keystone

View File

@ -52,9 +52,15 @@
- name: Waiting for bootstrap container to exit
command: docker wait bootstrap_neutron
register: bootstrap_result
run_once: True
when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed
- name: Checking for bootstrap failures
fail: msg="Bootstrapping failed"
run_once: True
when: bootstrap_result|changed and bootstrap_result.stdout != "0"
- name: Cleaning up Neutron bootstrap container
docker:
name: bootstrap_neutron

View File

@ -51,9 +51,15 @@
# https://github.com/ansible/ansible-modules-core/pull/1031
- name: Waiting for bootstrap container to exit
command: docker wait bootstrap_nova
register: bootstrap_result
run_once: True
when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed
- name: Checking for bootstrap failures
fail: msg="Bootstrapping failed"
run_once: True
when: bootstrap_result|changed and bootstrap_result.stdout != "0"
- name: Cleaning up Nova bootstrap container
docker:
name: bootstrap_nova

View File

@ -48,8 +48,13 @@
- name: Waiting for bootstrap container
command: docker wait rabbitmq_bootstrap
register: bootstrap_result
when: exists.rc != 0
- name: Checking for bootstrap failures
fail: msg="Bootstrapping failed"
when: bootstrap_result|changed and bootstrap_result.stdout != "0"
- name: Cleaning up bootstrap container
docker:
image: "{{ rabbitmq_image_full }}"