report: true
action: "batch"
register: lvm_batch_report
+ failed_when: false
environment:
CEPH_VOLUME_DEBUG: 1
when:
when:
- devices | default([]) | length > 0
- osd_scenario == 'lvm'
+ - (lvm_batch_report.stdout | from_json).changed
+
+ - name: run 'ceph-volume lvm list' to see how many osds have already been created
+ ceph_volume:
+ action: "list"
+ register: lvm_list
+ environment:
+ CEPH_VOLUME_DEBUG: 1
+ when:
+ - devices | default([]) | length > 0
+ - osd_scenario == 'lvm'
+ - not (lvm_batch_report.stdout | from_json).changed
+
+ - name: set_fact num_osds from the output of 'ceph-volume lvm list'
+ set_fact:
+ num_osds: "{{ lvm_list.stdout | from_json | length | int }}"
+ when:
+ - devices | default([]) | length > 0
+ - osd_scenario == 'lvm'
+ - not (lvm_batch_report.stdout | from_json).changed
when:
- inventory_hostname in groups.get(osd_group_name, [])