]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
Fix Ansible check mode for site.yml.sample playbook
authorBenoît Knecht <bknecht@protonmail.ch>
Tue, 1 Sep 2020 09:24:59 +0000 (11:24 +0200)
committerGuillaume Abrioux <gabrioux@redhat.com>
Wed, 7 Oct 2020 05:06:54 +0000 (07:06 +0200)
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>
(cherry picked from commit 54ba38e35ea67c1c342b008be675103e120982d0)

roles/ceph-crash/tasks/main.yml
roles/ceph-mgr/tasks/common.yml
roles/ceph-mgr/tasks/mgr_modules.yml
roles/ceph-mon/tasks/ceph_keys.yml
roles/ceph-osd/tasks/common.yml
roles/ceph-osd/tasks/main.yml
roles/ceph-rgw/tasks/common.yml
site.yml.sample

index 2b360a65ec03b3b7b8a7b928841f81451ad1b62d..788e49ff475d21be287d34886dd4659b412ecbd5 100644 (file)
@@ -47,6 +47,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
@@ -68,4 +69,4 @@
     state: started
     enabled: yes
     masked: no
-    daemon_reload: yes
\ No newline at end of file
+    daemon_reload: yes
index 193b72f27d781c3c5412f94728c7bb97074f7851..b3cd93e00ca451cecc0bbc832f16072f8693cbc5 100644 (file)
@@ -74,6 +74,7 @@
       with_items: "{{ _mgr_keys.results }}"
       when:
         - cephx | bool
+        - item is not skipped
         - item.item.copy_key | bool
 
 - name: set mgr key permissions
index 1f5f216a2cacdfbefd108f886345bd5865ae3293..dd7fd615202a01145e5fda2028f0fc8bd3d0a0bd 100644 (file)
@@ -18,6 +18,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"
index d824435fe8b64cfcf28de1e9455470278a6187eb..7d8ac9f71722eeb651215803c10b496a042429be 100644 (file)
@@ -15,6 +15,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:
index da9c3946af716c8c43f693198c2167238905d8fa..5bd7964a562e4ed64f06ebe84022be53c62f57ea 100644 (file)
@@ -33,4 +33,5 @@
   with_items: "{{ _osd_keys.results }}"
   when:
     - cephx | bool
+    - item is not skipped
     - item.item.copy_key | bool
index 7a9f805201abca20d4c2fbe85d2a5cf4d9c65c72..ef8b048eb0e08de26f71f4cab9c2839835f5fed6 100644 (file)
@@ -86,6 +86,7 @@
     - (wait_for_all_osds_up.stdout | from_json)["osdmap"]["osdmap"]["num_osds"] | int > 0
     - (wait_for_all_osds_up.stdout | from_json)["osdmap"]["osdmap"]["num_osds"] == (wait_for_all_osds_up.stdout | from_json)["osdmap"]["osdmap"]["num_up_osds"]
   when:
+    - not ansible_check_mode
     - inventory_hostname == ansible_play_hosts_all | last
 
 - name: include crush_rules.yml
index fa40a158939ed0512cbb0d60f7fdd755be5c40a3..5b06e086cae2323124c2acb5b13380c069e67e9f 100644 (file)
@@ -30,4 +30,5 @@
   with_items: "{{ _rgw_keys.results }}"
   when:
     - cephx | bool
+    - item is not skipped
     - item.item.copy_key | bool
index 374ce878ec499d24d5803bc73d0d122a97d260f9..9475861960a02e8c103365ee16e1b541554f94e1 100644 (file)
         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