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