]> 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>
Tue, 6 Oct 2020 22:29:44 +0000 (00:29 +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>
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 2423326751f78b69bba9d81ecaa7bbfc9d80ee18..eb693c15fe326d211d85c08d6797353410779ebb 100644 (file)
@@ -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
index 79bcd43e68b5e25a624332abc6941d4009532169..2abccc7e147433f39b307a5445a844bdbb2847ee 100644 (file)
@@ -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
index 85ed88b0434cdd70c1de4a067a7792d7605d8344..18cac848a24c65679bc75e537c0d506dc9a0ad28 100644 (file)
@@ -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"
index ee14cb3eb524412a049c72a110fabee1d1403ef2..7f67b455875de23db564b960ba12bed2c13ef68f 100644 (file)
@@ -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:
index e1c156c4f5b8ba1664bcfbbf4f7270757fbbbc86..5a87748cdb7a69165f1fe5c37e1dea3267b6e2a4 100644 (file)
@@ -33,4 +33,5 @@
   with_items: "{{ _osd_keys.results }}"
   when:
     - cephx | bool
+    - item is not skipped
     - item.item.copy_key | bool
index 492696dc17c33b050f84c7d00b67b3d24be60e8d..309e35488e5147472d2ea8c465763d023f72ecbc 100644 (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"] == (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
index f4764294e1eef56150f7dc526a1cc0e3e2144f44..04ba17e894ca8e2291cc5987c8b20174da0b10b9 100644 (file)
@@ -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
index ab243ffdd6501431e489f14339f772378b58e3c8..0c65034a27a4e7949cac70f73af43d522207c341 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