From: Benoît Knecht Date: Tue, 1 Sep 2020 09:24:59 +0000 (+0200) Subject: Fix Ansible check mode for site.yml.sample playbook X-Git-Tag: v5.0.3~55 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c733af9d43e572c97f301e7f704676f2ea5660dc;p=ceph-ansible.git 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 (cherry picked from commit 54ba38e35ea67c1c342b008be675103e120982d0) --- diff --git a/roles/ceph-crash/tasks/main.yml b/roles/ceph-crash/tasks/main.yml index e27bc7965..01b85fd01 100644 --- a/roles/ceph-crash/tasks/main.yml +++ b/roles/ceph-crash/tasks/main.yml @@ -46,6 +46,7 @@ with_items: "{{ list_target_node }}" delegate_to: "{{ item }}" run_once: True + when: _crash_keys is not skipped - name: start ceph-crash daemon when: containerized_deployment | bool @@ -67,4 +68,4 @@ state: started enabled: yes masked: no - daemon_reload: yes \ No newline at end of file + daemon_reload: yes diff --git a/roles/ceph-mgr/tasks/common.yml b/roles/ceph-mgr/tasks/common.yml index 8f94c8b9c..e924dcac2 100644 --- a/roles/ceph-mgr/tasks/common.yml +++ b/roles/ceph-mgr/tasks/common.yml @@ -72,6 +72,7 @@ with_items: "{{ _mgr_keys.results }}" when: - cephx | bool + - item is not skipped - item.item.copy_key | bool - name: set mgr key permissions diff --git a/roles/ceph-mgr/tasks/mgr_modules.yml b/roles/ceph-mgr/tasks/mgr_modules.yml index 85ed88b04..18cac848a 100644 --- a/roles/ceph-mgr/tasks/mgr_modules.yml +++ b/roles/ceph-mgr/tasks/mgr_modules.yml @@ -14,6 +14,7 @@ until: - mgr_dump.rc == 0 - (mgr_dump.stdout | from_json).available | bool + when: not ansible_check_mode - 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" diff --git a/roles/ceph-mon/tasks/ceph_keys.yml b/roles/ceph-mon/tasks/ceph_keys.yml index afcb6ecca..f7b41405d 100644 --- a/roles/ceph-mon/tasks/ceph_keys.yml +++ b/roles/ceph-mon/tasks/ceph_keys.yml @@ -14,6 +14,7 @@ retries: "{{ handler_health_mon_check_retries }}" delay: "{{ handler_health_mon_check_delay }}" changed_when: false + when: not ansible_check_mode - name: fetch ceph initial keys ceph_key: diff --git a/roles/ceph-osd/tasks/common.yml b/roles/ceph-osd/tasks/common.yml index 576b8991a..989830952 100644 --- a/roles/ceph-osd/tasks/common.yml +++ b/roles/ceph-osd/tasks/common.yml @@ -33,4 +33,5 @@ with_items: "{{ _osd_keys.results }}" when: - cephx | bool + - item is not skipped - item.item.copy_key | bool diff --git a/roles/ceph-osd/tasks/main.yml b/roles/ceph-osd/tasks/main.yml index 492696dc1..309e35488 100644 --- a/roles/ceph-osd/tasks/main.yml +++ b/roles/ceph-osd/tasks/main.yml @@ -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"] == (wait_for_all_osds_up.stdout | from_json)["osdmap"]["num_up_osds"] when: + - not ansible_check_mode - inventory_hostname == ansible_play_hosts_all | last - name: include crush_rules.yml diff --git a/roles/ceph-rgw/tasks/common.yml b/roles/ceph-rgw/tasks/common.yml index 5e0520c69..873de6903 100644 --- a/roles/ceph-rgw/tasks/common.yml +++ b/roles/ceph-rgw/tasks/common.yml @@ -30,6 +30,7 @@ with_items: "{{ _rgw_keys.results }}" when: - cephx | bool + - item is not skipped - item.item.copy_key | bool - name: copy SSL certificate & key data to certificate path diff --git a/site.yml.sample b/site.yml.sample index 374ce878e..947586196 100644 --- a/site.yml.sample +++ b/site.yml.sample @@ -490,4 +490,6 @@ msg: "{{ ceph_status.stdout_lines }}" delegate_to: "{{ groups[mon_group_name][0] }}" run_once: true - when: not ceph_status.failed + when: + - ceph_status is not skipped + - ceph_status is successful