Browse Source

add stack dry run check

Tzu-Mainn Chen 7 years ago
parent
commit
8c888849cb
1 changed files with 18 additions and 0 deletions
  1. 18 0
      roles/openshift_openstack/tasks/provision.yml

+ 18 - 0
roles/openshift_openstack/tasks/provision.yml

@@ -14,6 +14,24 @@
   register: template_validation_output
   when: openstack_cli_exists|succeeded
 
+- name: Dry-run the stack
+  command: openstack stack create --dry-run -t {{ stack_template_path }} {{ openshift_openstack_stack_name }}
+  ignore_errors: True
+  register: stack_dry_run_output
+  when: openstack_cli_exists|succeeded
+
+- name: Show the dry run errors
+  debug: var=stack_dry_run_output.stderr
+  when:
+  - openstack_cli_exists|succeeded
+  - stack_dry_run_output|failed
+
+- fail:
+    msg: The Heat stack creation failed. Please inspect the message above.
+  when:
+  - openstack_cli_exists|succeeded
+  - stack_dry_run_output|failed
+
 - name: Handle the Stack (create/delete)
   ignore_errors: True
   register: stack_create