]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
validate: fix wrong conditions v3.2.57
authorGuillaume Abrioux <gabrioux@redhat.com>
Fri, 25 Mar 2022 14:59:32 +0000 (15:59 +0100)
committerGuillaume Abrioux <gabrioux@redhat.com>
Fri, 25 Mar 2022 15:37:36 +0000 (16:37 +0100)
`devices` has a default value set in `ceph-defaults` which is `[]`
it makes check_devices fail.
See details in corresponding BZ

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=2068353
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
infrastructure-playbooks/add-osd.yml
roles/ceph-facts/tasks/facts.yml
roles/ceph-osd/tasks/main.yml
roles/ceph-validate/tasks/check_devices.yml

index 17cbc38c445313426c212b5c797f540514e4e9a0..71813b05da196ec7be21100e20114931dfe546ee 100644 (file)
       set_fact:
         add_osd: True
 
+    - name: set_fact docker_exec_cmd
+      set_fact:
+        docker_exec_cmd: "docker exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] }}"
+      delegate_to: "{{ groups[mon_group_name][0] }}"
+      delegate_facts: true
+      run_once: true
+      when:
+        - containerized_deployment
+        - groups.get(mon_group_name, []) | length > 0
+
   roles:
     - role: ceph-defaults
     - role: ceph-facts
index 0cb638b2f9e8fc178269b44bf03696bbe11f7152..a8a4daeb3fc104e48a77b0cfe65c4d302213c271 100644 (file)
   with_items: "{{ devices }}"
   register: devices_prepare_canonicalize
   when:
-    - devices is defined
+    - devices | length > 0
     - inventory_hostname in groups.get(osd_group_name, [])
     - not osd_auto_discovery|default(False)
 
     devices: "{{ devices | default([]) + [ item.stdout ] }}"
   with_items: "{{ devices_prepare_canonicalize.results }}"
   when:
-    - devices is defined
+    - devices | length > 0
     - inventory_hostname in groups.get(osd_group_name, [])
     - not osd_auto_discovery|default(False)
 
   set_fact:
     devices: "{{ devices | reject('search','/dev/disk') | list | unique }}"
   when:
-    - devices is defined
+    - devices | length > 0
     - inventory_hostname in groups.get(osd_group_name, [])
     - not osd_auto_discovery|default(False)
 
index 3ddb307c88795e65b5cbcec22f255165a0285956..335e145c977943e5020c68a4fa68440c1d3de0e2 100644 (file)
   changed_when: false
   delegate_to: "{{ groups[mon_group_name][0] }}"
   until:
-    - (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"]
+    - (wait_for_all_osds_up.stdout | default('{}') | from_json)["osdmap"]["osdmap"]["num_osds"] | int > 0
+    - (wait_for_all_osds_up.stdout | default('{}') | from_json)["osdmap"]["osdmap"]["num_osds"] == (wait_for_all_osds_up.stdout | default('{}') from_json)["osdmap"]["osdmap"]["num_up_osds"]
   when:
     - inventory_hostname == ansible_play_hosts_all | last
 
index 4afb3dcf6267351f4d780b330fefdc940491c92e..53d33b5cfb33730fe80394fefadba0f610effc89 100644 (file)
@@ -65,7 +65,7 @@
       with_items: "{{ lvm_volumes | default(devices) }}"
       when:
         - inventory_hostname in groups.get(osd_group_name, [])
-        - (item.data is defined and item.data_vg is undefined) or devices is defined
+        - (item.data is defined and item.data_vg is undefined) or devices | length > 0
 
     - name: fail when gpt header found on osd devices
       fail: