purge-cluster: add a check for a device list

People who use `osd_auto_discovery` feature will not have a devices
variable populated, so we first check for the existence of devices.

Signed-off-by: Sébastien Han <seb@redhat.com>
pull/646/head
Sébastien Han 2016-03-24 11:38:56 +01:00
parent 14e957dfec
commit d9fb812029
1 changed files with 7 additions and 0 deletions

View File

@ -59,6 +59,13 @@
state: absent state: absent
tasks: tasks:
- name: check for a device list
fail:
msg: "OSD automatic discovery was detected, purge cluster does not support this scenario. If you want to purge the cluster, manually provide the list of devices in group_vars/osds using the devices variable."
when:
devices is not defined and
osd_auto_discovery
- name: get osd numbers - name: get osd numbers
shell: "if [ -d /var/lib/ceph/osd ] ; then ls /var/lib/ceph/osd | cut -d '-' -f 2 ; fi" shell: "if [ -d /var/lib/ceph/osd ] ; then ls /var/lib/ceph/osd | cut -d '-' -f 2 ; fi"
register: osd_ids register: osd_ids