ceph-config: use 'lvm list' to find num_osds for an existing cluster

This makes finding num_osds idempotent for clusters that were deployed
using 'lvm batch'.

Signed-off-by: Andrew Schoen <aschoen@redhat.com>
pull/3206/head
Andrew Schoen 2018-09-25 15:25:40 -05:00 committed by Sébastien Han
parent 2ffad1b43a
commit 40f82319dd
1 changed files with 21 additions and 0 deletions

View File

@ -38,6 +38,7 @@
report: true
action: "batch"
register: lvm_batch_report
failed_when: false
environment:
CEPH_VOLUME_DEBUG: 1
when:
@ -50,6 +51,26 @@
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, [])