Browse Source

Add openstack stack failures list if stack fails to create

Tzu-Mainn Chen 7 years ago
parent
commit
9b39e1d6f4
1 changed files with 19 additions and 1 deletions
  1. 19 1
      roles/openshift_openstack/tasks/provision.yml

+ 19 - 1
roles/openshift_openstack/tasks/provision.yml

@@ -15,7 +15,7 @@
   when: openstack_cli_exists|succeeded
 
 - name: Handle the Stack (create/delete)
-  ignore_errors: False
+  ignore_errors: True
   register: stack_create
   os_stack:
     name: "{{ openshift_openstack_stack_name }}"
@@ -23,6 +23,24 @@
     template: "{{ stack_template_path | default(omit) }}"
     wait: yes
 
+- name: get errors in stack creation, if any
+  command: openstack stack failures list {{ openshift_openstack_stack_name }}
+  register: stack_create_failures
+  when:
+  - openstack_cli_exists|succeeded
+  - stack_create|failed
+
+- name: show errors in stack creation, if any
+  debug: var=stack_create_failures
+  when:
+  - openstack_cli_exists|succeeded
+  - stack_create|failed
+
+- fail:
+    msg: Stack creation failed
+  when:
+  - stack_create|failed
+
 - name: Add the new nodes to the inventory
   meta: refresh_inventory