You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.2KB

  1. ---
  2. - name: assert that the user has confirmed the purge
  3. assert:
  4. that: "{{REALLY_PURGE_HARDDISKS_WHICH_WILL_DESTROY_EVERYTHING_ON_YOUR_HARDDISKS_I_KNOW_WHAT_I_AM_DOING|bool}}"
  5. - name: ensure required debian packages are present
  6. apt:
  7. pkg:
  8. - util-linux
  9. - lsof
  10. - block:
  11. - import_tasks: clean-target.yaml
  12. - import_tasks: deactivate-lvm.yaml
  13. when: REALLY_PURGE_HARDDISKS_WHICH_WILL_DESTROY_EVERYTHING_ON_YOUR_HARDDISKS_I_KNOW_WHAT_I_AM_DOING|bool
  14. - name: purge hard disks
  15. shell: |
  16. wipefs --all /dev/dm-*
  17. vgchange -an
  18. pvremove -ff -y /dev/md*
  19. vgchange -an
  20. wipefs --all /dev/md*
  21. mdadm --stop /dev/md*
  22. mdadm --zero-superblock /dev/sd*
  23. mdadm --zero-superblock /dev/nvme*
  24. mdadm --stop /dev/md*
  25. vgchange -an
  26. pvremove -ff -y /dev/sd*
  27. pvremove -ff -y /dev/nvme*
  28. vgchange -an
  29. wipefs --all /dev/sd*
  30. wipefs --all /dev/sd*
  31. wipefs --all /dev/nvme*
  32. wipefs --all /dev/nvme*
  33. blkdiscard /dev/nvme0n1
  34. blkdiscard /dev/nvme1n1
  35. args:
  36. executable: /bin/bash
  37. failed_when: false
  38. when: REALLY_PURGE_HARDDISKS_WHICH_WILL_DESTROY_EVERYTHING_ON_YOUR_HARDDISKS_I_KNOW_WHAT_I_AM_DOING|bool