]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
purge_cluster: wipe all partitions
authorGuillaume Abrioux <gabrioux@redhat.com>
Wed, 16 May 2018 15:34:38 +0000 (17:34 +0200)
committerSébastien Han <seb@redhat.com>
Thu, 17 May 2018 06:37:17 +0000 (08:37 +0200)
In order to ensure there is no leftover after having purged a cluster,
we must wipe all partitions properly.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1492242
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
infrastructure-playbooks/purge-cluster.yml

index 71979471bd50a5afc2add28862cd8eedfdfeb3cf..bcba8b05addcebca367ff2da6509e335b0559065 100644 (file)
     set_fact:
       resolved_parent_device: "{{ tmp_resolved_parent_device.results | map(attribute='stdout') | list | unique }}"
 
+  - name: wipe partitions
+    shell: |
+      wipefs --all "{{ item }}"
+      dd if=/dev/zero of="{{ item }}" bs=1 count=4096
+    with_items: "{{ combined_devices_list }}"
+
   - name: zap ceph journal/block db/block wal partitions
     shell: |
       # if the disk passed is a raw device AND the boot system disk
-      if parted -s "/dev/{{ item }}" print | grep -sq boot; then
+      if parted -s /dev/"{{ item }}" print | grep -sq boot; then
         echo "Looks like /dev/{{ item }} has a boot partition,"
         echo "if you want to delete specific partitions point to the partition instead of the raw device"
         echo "Do not use your system disk!"
         exit 1
       fi
-      sgdisk -Z "/dev/{{ item }}"
-      dd if=/dev/zero of="/dev/{{ item }}" bs=1M count=200
+      sgdisk -Z --clear --mbrtogpt -g -- /dev/"{{ item }}"
+      dd if=/dev/zero of=/dev/"{{ item }}" bs=1M count=200
+      parted -s /dev/"{{ item }}" mklabel gpt
+      partprobe /dev/"{{ item }}"
       udevadm settle --timeout=600
     with_items:
       - "{{ resolved_parent_device }}"