Fix Ansible check mode for site.yml.sample playbook

Make sure the `site.yml.sample` playbook can be run in check mode by skipping
tasks that try to read the output of commands that have been skipped.

Signed-off-by: Benoît Knecht <bknecht@protonmail.ch>
pull/5922/head
Benoît Knecht 2020-09-01 11:24:59 +02:00 committed by Guillaume Abrioux
parent e5713ea5d5
commit 54ba38e35e
8 changed files with 11 additions and 2 deletions

View File

@ -46,6 +46,7 @@
with_items: "{{ list_target_node }}" with_items: "{{ list_target_node }}"
delegate_to: "{{ item }}" delegate_to: "{{ item }}"
run_once: True run_once: True
when: _crash_keys is not skipped
- name: start ceph-crash daemon - name: start ceph-crash daemon
when: containerized_deployment | bool when: containerized_deployment | bool
@ -67,4 +68,4 @@
state: started state: started
enabled: yes enabled: yes
masked: no masked: no
daemon_reload: yes daemon_reload: yes

View File

@ -72,6 +72,7 @@
with_items: "{{ _mgr_keys.results }}" with_items: "{{ _mgr_keys.results }}"
when: when:
- cephx | bool - cephx | bool
- item is not skipped
- item.item.copy_key | bool - item.item.copy_key | bool
- name: set mgr key permissions - name: set mgr key permissions

View File

@ -14,6 +14,7 @@
until: until:
- mgr_dump.rc == 0 - mgr_dump.rc == 0
- (mgr_dump.stdout | from_json).available | bool - (mgr_dump.stdout | from_json).available | bool
when: not ansible_check_mode
- name: get enabled modules from ceph-mgr - name: get enabled modules from ceph-mgr
command: "{{ hostvars[groups[mon_group_name][0]]['container_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} --format json mgr module ls" command: "{{ hostvars[groups[mon_group_name][0]]['container_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} --format json mgr module ls"

View File

@ -14,6 +14,7 @@
retries: "{{ handler_health_mon_check_retries }}" retries: "{{ handler_health_mon_check_retries }}"
delay: "{{ handler_health_mon_check_delay }}" delay: "{{ handler_health_mon_check_delay }}"
changed_when: false changed_when: false
when: not ansible_check_mode
- name: fetch ceph initial keys - name: fetch ceph initial keys
ceph_key: ceph_key:

View File

@ -33,4 +33,5 @@
with_items: "{{ _osd_keys.results }}" with_items: "{{ _osd_keys.results }}"
when: when:
- cephx | bool - cephx | bool
- item is not skipped
- item.item.copy_key | bool - item.item.copy_key | bool

View File

@ -86,6 +86,7 @@
- (wait_for_all_osds_up.stdout | from_json)["osdmap"]["num_osds"] | int > 0 - (wait_for_all_osds_up.stdout | from_json)["osdmap"]["num_osds"] | int > 0
- (wait_for_all_osds_up.stdout | from_json)["osdmap"]["num_osds"] == (wait_for_all_osds_up.stdout | from_json)["osdmap"]["num_up_osds"] - (wait_for_all_osds_up.stdout | from_json)["osdmap"]["num_osds"] == (wait_for_all_osds_up.stdout | from_json)["osdmap"]["num_up_osds"]
when: when:
- not ansible_check_mode
- inventory_hostname == ansible_play_hosts_all | last - inventory_hostname == ansible_play_hosts_all | last
- name: include crush_rules.yml - name: include crush_rules.yml

View File

@ -30,6 +30,7 @@
with_items: "{{ _rgw_keys.results }}" with_items: "{{ _rgw_keys.results }}"
when: when:
- cephx | bool - cephx | bool
- item is not skipped
- item.item.copy_key | bool - item.item.copy_key | bool
- name: copy SSL certificate & key data to certificate path - name: copy SSL certificate & key data to certificate path

View File

@ -488,4 +488,6 @@
msg: "{{ ceph_status.stdout_lines }}" msg: "{{ ceph_status.stdout_lines }}"
delegate_to: "{{ groups[mon_group_name][0] }}" delegate_to: "{{ groups[mon_group_name][0] }}"
run_once: true run_once: true
when: not ceph_status.failed when:
- ceph_status is not skipped
- ceph_status is successful