Merge "Run NetworkDeployment as async task"

This commit is contained in:
Zuul 2018-10-21 18:03:31 +00:00 committed by Gerrit Code Review
commit c23540d4a5
1 changed files with 34 additions and 6 deletions

View File

@ -135,6 +135,10 @@
become: true
when: (force | bool)
- name: Set fact for async_deployment
set_fact:
use_async_deployment: "{{ (async_deployment | default(False)) or (item == 'NetworkDeployment') }}"
- name: "Run deployment {{ item }}"
shell: |
/usr/libexec/os-refresh-config/configure.d/55-heat-config
@ -142,18 +146,42 @@
become: true
environment:
HEAT_SHELL_CONFIG: /var/lib/heat-config/tripleo-config-download/{{ item ~ '-' ~ deployment_uuid }}
register: deployment_result
register: deployment_sync_result
ignore_errors: yes
when: not use_async_deployment
- name: "Output for {{ item }}"
- name: "Run async deployment {{ item }}"
shell: |
/usr/libexec/os-refresh-config/configure.d/55-heat-config
exit $(jq .deploy_status_code /var/lib/heat-config/deployed/{{ deployment_uuid }}.notify.json)
become: true
environment:
HEAT_SHELL_CONFIG: /var/lib/heat-config/tripleo-config-download/{{ item ~ '-' ~ deployment_uuid }}
register: deployment_async_result
ignore_errors: yes
when: use_async_deployment
async: "{{ async_timeout | default(300) }}"
poll: "{{ async_poll | default(3) }}"
- name: "Output for sync deployment {{ item }}"
debug:
msg:
- stderr: "{{ deployment_result.stderr.split('\n') }}"
- status_code: "{{ deployment_result.rc }}"
- stderr: "{{ deployment_sync_result.stderr.split('\n') }}"
- status_code: "{{ deployment_sync_result.rc }}"
tags:
- output
failed_when: deployment_result.rc != 0
when: not ansible_check_mode
failed_when: deployment_sync_result.rc != 0
when: not ansible_check_mode and not use_async_deployment
- name: "Output for async deployment {{ item }}"
debug:
msg:
- stderr: "{{ deployment_async_result.stderr.split('\n') }}"
- status_code: "{{ deployment_async_result.rc }}"
tags:
- output
failed_when: deployment_async_result.rc != 0
when: not ansible_check_mode and use_async_deployment
- name: "Check-mode for Run deployment {{ item }} (changed status indicates deployment would run)"
stat: