]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
ceph-config: default devices and lvm_volumes when setting num_osds
authorAndrew Schoen <aschoen@redhat.com>
Tue, 18 Sep 2018 14:36:08 +0000 (09:36 -0500)
committermergify[bot] <mergify[bot]@users.noreply.github.com>
Tue, 18 Sep 2018 17:02:33 +0000 (17:02 +0000)
This avoids errors when the osd scenario choosen does not require
setting devices or lvm_volumes. The default values for these are not
set because they exist in the ceph-osd role, not ceph-defaults.

Signed-off-by: Andrew Schoen <aschoen@redhat.com>
roles/ceph-config/tasks/main.yml

index a6239ec755691f32bd608d4ae64e477c68553c16..da48db96ad0a8e79b444b7d33fc557e53eb80981 100644 (file)
       set_fact:
         num_osds: "{{ devices | length | int }}"
       when:
-        - devices | length > 0
+        - devices | default([]) | length > 0
         - (osd_scenario == 'collocated' or osd_scenario == 'non-collocated')
 
     - name: count number of osds for lvm scenario
       set_fact:
         num_osds: "{{ lvm_volumes | length | int }}"
       when:
-        - lvm_volumes | length > 0
+        - lvm_volumes | default([]) | length > 0
         - osd_scenario == 'lvm'
 
     - name: get number of osds for lvm-batch scenario
       command: "ceph-volume lvm batch --report --format=json --osds-per-device osds_per_device {{ devices | join(' ') }}"
       register: lvm_batch_devices
       when:
-        - devices | length > 0
+        - devices | default([]) | length > 0
         - osd_scenario == 'lvm'
 
     - name: set_fact num_osds
       set_fact:
         num_osds: "{{ (lvm_batch_devices.stdout | from_json).osds | length | int }}"
       when:
-        - devices | length > 0
+        - devices | default([]) | length > 0
         - osd_scenario == 'lvm'
     when:
       - inventory_hostname in groups.get(osd_group_name, [])