Merge pull request #646 from ceph/fix-purge-ubuntu

Fix purge ubuntu
pull/649/head
Leseb 2016-03-24 15:14:54 +01:00
commit c691638c3e
1 changed files with 24 additions and 10 deletions

View File

@ -59,6 +59,13 @@
state: absent
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
shell: "if [ -d /var/lib/ceph/osd ] ; then ls /var/lib/ceph/osd | cut -d '-' -f 2 ; fi"
register: osd_ids
@ -90,8 +97,8 @@
osd_group_name in group_names
- name: stop ceph mons with systemd
service:
name: ceph-mon@{{ ansible_hostname }}
service:
name: ceph-mon@{{ ansible_hostname }}
state: stopped
enabled: no
when:
@ -100,8 +107,8 @@
mon_group_name in group_names
- name: stop ceph mdss with systemd
service:
name: ceph-mds@{{ ansible_hostname }}
service:
name: ceph-mds@{{ ansible_hostname }}
state: stopped
when:
ansible_os_family == 'RedHat' and
@ -132,19 +139,20 @@
# Ubuntu 14.04
- name: stop ceph osds on ubuntu
command: stop ceph-osd-all
command: stop ceph-osd id={{ item }}
failed_when: false
when:
ansible_distribution == 'Ubuntu' and
osd_group_name in group_names
with_items: "{{ osd_ids.stdout_lines }}"
- name: stop ceph mons on ubuntu
command: stop ceph-mon-all
command: stop ceph-mon id={{ ansible_hostname }}
failed_when: false
when:
ansible_distribution == 'Ubuntu' and
mon_group_name in group_names
- name: stop ceph mdss on ubuntu
command: stop ceph-mds-all
failed_when: false
@ -181,14 +189,20 @@
when:
osd_group_name in group_names
- name: remove monitor store and bootstrap keys
shell: rm -rf /var/lib/ceph/
failed_when: false
when:
mon_group_name in group_names
- name: is reboot needed
local_action: shell echo requesting reboot
notify:
- restart machine
- wait for server to boot
- remove data
when:
osd_group_name in group_names and
when:
osd_group_name in group_names and
remove_osd_mountpoints.rc != 0
- name: zap osd disks
@ -203,7 +217,7 @@
when:
osd_group_name in group_names and
raw_multi_journal and
zap_journal_disks
zap_journal_disks
- name: purge ceph packages with yum
yum: