Run NetworkDeployment as async task
This commit adds special handling of the NetworkDeployment such that it
will be run as an async task with ansible. This should prevent any
issues where the network configuration causes the ssh connection to drop
and the ansible task to either be unnecessarily retried or failed.
Also added are three variables that can be used to control the async
behavior:
async_deployment: boolean which will toggle running all deployments in
async mode.
async_timeout: timeout in seconds to wait for async tasks
async_poll: interval in seconds to check async task status
These variables can only be set if running the config-download process
manually, however a future patch could wire them up to Heat parameters.
Change-Id: If1f35980a98a9015ca65f2c6a3e4db04725f1c10
Closes-Bug: #1792343
(cherry picked from commit ac4ac838e1
)
This commit is contained in:
parent
800e0aaf8f
commit
a2550158e1
|
@ -34,6 +34,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
|
||||
|
@ -41,14 +45,39 @@
|
|||
become: true
|
||||
environment:
|
||||
HEAT_SHELL_CONFIG: /var/lib/heat-config/tripleo-config-download/{{ item }}
|
||||
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 }}
|
||||
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
|
||||
failed_when: deployment_sync_result.rc != 0
|
||||
when: 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: use_async_deployment
|
||||
|
|
Loading…
Reference in New Issue