]> 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:19 +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 e27bc796584b4d808d9b60c7067c14727f4b24ac..01b85fd0181c8d1bf80b8e2dab2f987384b2c7c6 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 8f94c8b9cfdf181f0376c2d3d6e551fa5a83fd45..e924dcac2a56172cb5fdd159541b64573a207eb7 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 afcb6ecca4482d6d0b829e948eb54b9ec16af301..f7b41405d6144424267aa3ae7d3194cf833ad10d 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 576b8991a7d138945ef420aee9f2faf3ba91bb95..989830952f0bdd92043353c4e919c87994b7bcf5 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 5e0520c6996bff57c1a692d4a351298052bfc150..873de6903c368051c1cad2525e26fbbbcc6f8bde 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 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