From 14e957dfec18ad6806bf610988b538b4ce0e0971 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Thu, 24 Mar 2016 11:37:35 +0100 Subject: [PATCH 1/3] purge-cluster: make stop service work on ubuntu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit reworked the stop sequence by using ids instead of calling the 'all' function which does not seem to be working all the time. Signed-off-by: Sébastien Han --- purge-cluster.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/purge-cluster.yml b/purge-cluster.yml index 5841bdba1..0ac58b681 100644 --- a/purge-cluster.yml +++ b/purge-cluster.yml @@ -90,8 +90,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 +100,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 +132,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 From d9fb812029874144f319e548e3176abc7b912ded Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Thu, 24 Mar 2016 11:38:56 +0100 Subject: [PATCH 2/3] purge-cluster: add a check for a device list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- purge-cluster.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/purge-cluster.yml b/purge-cluster.yml index 0ac58b681..63c4c7acb 100644 --- a/purge-cluster.yml +++ b/purge-cluster.yml @@ -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 From 53a62f0c89ee6491f7fce6b333e0e6f01150a8a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Thu, 24 Mar 2016 13:49:26 +0100 Subject: [PATCH 3/3] purge: remove monitor store and bootstrap keys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit remove monitor store and bootstrap keys otherwise the play can not complete Signed-off-by: Sébastien Han --- purge-cluster.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/purge-cluster.yml b/purge-cluster.yml index 63c4c7acb..02913f2d3 100644 --- a/purge-cluster.yml +++ b/purge-cluster.yml @@ -189,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 @@ -211,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: