Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Commit

Permalink
Allow more tasks to be run in check mode
Browse files Browse the repository at this point in the history
When running Ansible in check mode (aka dry run), some tasks need some
changes, specially around variables and make sure they are actually
defined.

Change-Id: I337aa287f1c88a0e2707b441fc6b19b997d52385
  • Loading branch information
EmilienM committed Jul 6, 2020
1 parent 8c0a98c commit df80033
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 3 deletions.
3 changes: 3 additions & 0 deletions common/deploy-steps-tasks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,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

Expand Down
4 changes: 4 additions & 0 deletions deployment/cinder/cinder-common-container-puppet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions deployment/haproxy/haproxy-pacemaker-puppet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,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
Expand Down
2 changes: 2 additions & 0 deletions deployment/haproxy/haproxy-public-tls-inject.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion deployment/neutron/neutron-dhcp-container-puppet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,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 is defined
- ipnetns_add_result.rc == 0
- name: create /var/lib/neutron
file:
path: /var/lib/neutron
Expand Down
4 changes: 3 additions & 1 deletion deployment/neutron/neutron-l3-container-puppet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,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 is defined
- ipnetns_add_result.rc == 0
- name: create /var/lib/neutron
file:
path: /var/lib/neutron
Expand Down
4 changes: 3 additions & 1 deletion deployment/ovn/ovn-metadata-container-puppet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,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 is defined
- ipnetns_add_result.rc == 0
- name: create /var/lib/neutron
file:
path: /var/lib/neutron
Expand Down

0 comments on commit df80033

Please sign in to comment.