Allow more tasks to be run in check mode

When running Ansible in check mode (aka dry run), some tasks need some
changes, specially around variables and make sure they are actually
defined.

Note: the backport is not clean, and we also fixed the tasks when paunch
is enabled, which wasn't the case anymore in the initial patch on
master. Also the tasks which check healthcheck aren't needed in check
mdoe, they take too much time for nothing.

Change-Id: I337aa287f1c88a0e2707b441fc6b19b997d52385
(cherry picked from commit a199da6a08)
(cherry picked from commit ebbad0d542)
This commit is contained in:
Emilien Macchi 2020-06-11 09:51:45 -04:00
parent 76ff521ed7
commit ab3548f23a
17 changed files with 34 additions and 3 deletions

View File

@ -43,6 +43,9 @@
delay: 3
failed_when:
- (not puppet_host_outputs.finished) or (puppet_host_outputs.rc is defined and puppet_host_outputs.rc not in [0, 2])
when:
- not (ansible_check_mode | bool)
- enable_puppet|bool
tags:
- host_config

View File

@ -31,6 +31,8 @@
until: generate_config_outputs.finished
retries: 1200
delay: 3
when:
- not (ansible_check_mode | bool)
- name: "Debug output for task: Run container-puppet tasks (generate config) during step 1"
debug:

View File

@ -31,6 +31,8 @@
PROCESS_COUNT: "{{ docker_puppet_process_count }}"
register: bootstrap_tasks_async_result
no_log: true
when:
- not (ansible_check_mode | bool)
- name: Wait for container-puppet tasks (bootstrap tasks) for step {{ step }} to finish
async_status:
@ -39,6 +41,8 @@
until: bootstrap_tasks_outputs.finished
retries: 1200
delay: 3
when:
- not (ansible_check_mode | bool)
- name: "Debug output for task: Run container-puppet tasks (bootstrap tasks) for step {{ step }}"
debug:

View File

@ -166,6 +166,8 @@ outputs:
vg: "cinder-volumes"
pvs: "{{ _loopback_device.stdout }}"
state: present
when:
- not (ansible_check_mode | bool)
- name: cinder create service to run losetup for LVM on startup
copy:
dest: /etc/systemd/system/cinder-lvm-losetup.service
@ -186,6 +188,8 @@ outputs:
[Install]
WantedBy=local-fs-pre.target
when:
- not (ansible_check_mode | bool)
- name: cinder enable the LVM losetup service
systemd:
name: cinder-lvm-losetup

View File

@ -371,6 +371,8 @@ outputs:
- name: set is_haproxy_bootstrap_node fact
tags: common
set_fact: is_haproxy_bootstrap_node={{haproxy_short_bootstrap_node_name|lower == ansible_hostname|lower}}
when:
- haproxy_short_bootstrap_node_name|default(false)
- name: Mount TLS cert if needed
when:
- step|int == 1

View File

@ -86,6 +86,8 @@ outputs:
- name: set is_haproxy_bootstrap_node fact
set_fact: is_haproxy_bootstrap_node={{haproxy_short_bootstrap_node_name | lower == ansible_hostname | lower}}
when:
- haproxy_short_bootstrap_node_name|default(false)
- name: get haproxy status
register: haproxy_state

View File

@ -428,7 +428,9 @@ outputs:
- - name: remove temp namespace
command: ip netns delete ns_temp
failed_when: false
when: ipnetns_add_result.rc == 0
when:
- ipnetns_add_result.rc is defined
- ipnetns_add_result.rc == 0
- - name: create /var/lib/neutron
file:
path: /var/lib/neutron

View File

@ -383,7 +383,9 @@ outputs:
- - name: remove temp namespace
command: ip netns delete ns_temp
failed_when: false
when: ipnetns_add_result.rc == 0
when:
- ipnetns_add_result.rc is defined
- ipnetns_add_result.rc == 0
- - name: create /var/lib/neutron
file:
path: /var/lib/neutron

View File

@ -506,6 +506,7 @@ outputs:
deploy_steps_tasks:
- name: validate nova api container state
when:
- not (ansible_check_mode | bool)
- container_cli == 'podman'
- not container_healthcheck_disabled
- step|int == 5

View File

@ -1048,6 +1048,7 @@ outputs:
deploy_steps_tasks:
- name: validate nova compute container state
when:
- not (ansible_check_mode | bool)
- container_cli == 'podman'
- not container_healthcheck_disabled
- step|int == 6 #FIXME: there is no step6

View File

@ -224,6 +224,7 @@ outputs:
deploy_steps_tasks:
- name: validate nova conductor container state
when:
- not (ansible_check_mode | bool)
- container_cli == 'podman'
- not container_healthcheck_disabled
- step|int == 5

View File

@ -812,6 +812,7 @@ outputs:
deploy_steps_tasks:
- name: validate nova-libvirt container state
when:
- not (ansible_check_mode | bool)
- container_cli == 'podman'
- not container_healthcheck_disabled
- step|int == 4

View File

@ -240,6 +240,7 @@ outputs:
deploy_steps_tasks:
- name: validate nova metadata container state
when:
- not (ansible_check_mode | bool)
- container_cli == 'podman'
- not container_healthcheck_disabled
- step|int == 5

View File

@ -168,6 +168,7 @@ outputs:
deploy_steps_tasks:
- name: validate nova migration target container state
when:
- not (ansible_check_mode | bool)
- container_cli == 'podman'
- not container_healthcheck_disabled
- step|int == 5

View File

@ -218,6 +218,7 @@ outputs:
deploy_steps_tasks:
- name: validate nova scheduler container state
when:
- not (ansible_check_mode | bool)
- container_cli == 'podman'
- not container_healthcheck_disabled
- step|int == 5

View File

@ -285,6 +285,7 @@ outputs:
deploy_steps_tasks:
- name: validate nova-vnc-proxy container state
when:
- not (ansible_check_mode | bool)
- container_cli == 'podman'
- not container_healthcheck_disabled
- step|int == 5

View File

@ -361,7 +361,9 @@ outputs:
- - name: remove temp namespace
command: ip netns delete ns_temp
failed_when: false
when: ipnetns_add_result.rc == 0
when:
- ipnetns_add_result.rc is defined
- ipnetns_add_result.rc == 0
- - name: create /var/lib/neutron
file:
path: /var/lib/neutron