[shrink-mon]: force playbook to fail if there is only one mon

The playbook will fail if only 1 mon is in the cluster
and advise to use the `purge-cluster` playbook instead.

Fix #1083
pull/1118/head
Guillaume Abrioux 2016-11-24 22:46:46 +01:00
parent 78b6ae7dae
commit b2b7222b3a
1 changed files with 6 additions and 0 deletions

View File

@ -30,6 +30,12 @@
- include_vars: roles/ceph-common/defaults/main.yml - include_vars: roles/ceph-common/defaults/main.yml
- include_vars: group_vars/all.yml - include_vars: group_vars/all.yml
- name: exit playbook, if only one monitor is present in cluster
fail:
msg: "You are about to shrink the only monitor present in the cluster.
If you really want to do that, please use the purge-cluster playbook."
when: "{{ groups[mon_group_name] | length | int == 1 }}"
- name: exit playbook, if user did not mean to shrink cluster - name: exit playbook, if user did not mean to shrink cluster
fail: fail:
msg: "Exiting shrink-mon playbook, no monitor(s) was/were removed. msg: "Exiting shrink-mon playbook, no monitor(s) was/were removed.