From 2e6233271e5e80a4ce2f3803272f791592ef1d65 Mon Sep 17 00:00:00 2001 From: yanyx Date: Tue, 18 Jul 2017 14:56:12 +0800 Subject: [PATCH] fix: when osd device is a disk partition --- infrastructure-playbooks/purge-cluster.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/infrastructure-playbooks/purge-cluster.yml b/infrastructure-playbooks/purge-cluster.yml index 5a756fd92..b1f1685eb 100644 --- a/infrastructure-playbooks/purge-cluster.yml +++ b/infrastructure-playbooks/purge-cluster.yml @@ -309,7 +309,14 @@ when: "{{ encrypted_ceph_partuuid.stdout_lines | length > 0 }}" - name: zap osd disks - shell: ceph-disk zap "{{ item }}" + shell: | + if (echo "{{ item }}" | grep -Esq '[0-9]{1,2}$'); then + raw_device=$(echo "{{ item }}" | grep -Eo '/dev/([hsv]d[a-z]{1,2}|cciss/c[0-9]d[0-9]|nvme[0-9]n[0-9]){1,2}') + partition_nb=$(echo "{{ item }}" | grep -Eo '[0-9]{1,2}$') + sgdisk --delete $partition_nb $raw_device + else + ceph-disk zap "{{ item }}" + fi with_items: "{{ devices }}" when: - ceph_disk_present.rc == 0