From e249098f7b9d13234c6ff7844e2af9ae1d01e2be Mon Sep 17 00:00:00 2001 From: leseb Date: Wed, 8 Jul 2015 10:34:16 +0200 Subject: [PATCH] Improve purge playbook We run a zap twice here since we can't combine with_items and with_sequence yet. This will land in Ansible 2.0. We destroy all the partitions and re-create new labels as well. We do this twice just because sometimes one is not sufficient. We also call partprobe to make sure that the kernel sees the changes. Signed-off-by: leseb --- purge-cluster.yml | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/purge-cluster.yml b/purge-cluster.yml index 5848d4a9f..dbdb1e437 100644 --- a/purge-cluster.yml +++ b/purge-cluster.yml @@ -12,21 +12,27 @@ tasks: - - name: Purge Ceph + - name: disk zap + command: /usr/sbin/sgdisk --zap-all --clear --mbrtogpt -g -- {{ item }} + with_items: devices + ignore_errors: true + + - name: disk zap + command: /usr/sbin/sgdisk --zap-all --clear --mbrtogpt -g -- {{ item }} + with_items: devices + ignore_errors: true + + - name: call partprobe + command: partprobe + + - name: purge ceph command: ceph-deploy purge {{ ansible_fqdn }} delegate_to: 127.0.0.1 - - name: Remove OSD data + - name: remove osd data shell: rm -rf /var/lib/ceph/osd/*/* ignore_errors: true - - name: Purge remaining data + - name: purge remaining data command: ceph-deploy purgedata {{ ansible_fqdn }} delegate_to: 127.0.0.1 - - - name: Purge partitions - shell: parted -s {{ item[0] }} rm {{ item[1] }} - with_nested: - - devices - - partitions - ignore_errors: true