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.

59 lines
1.2KB

  1. ---
  2. - name: shred device
  3. command:
  4. shred
  5. --iterations=1
  6. {{ item.device }}
  7. when: item.wipe is defined and item.wipe
  8. with_items: "{{ dmcrypt_devices }}"
  9. - name: ramdisk
  10. mount:
  11. src: ram
  12. fstype: ramfs
  13. name: /ram
  14. state: mounted
  15. - name: keyfile directory
  16. file:
  17. path: /ram/dmcrypt_devices/
  18. owner: root
  19. group: root
  20. mode: 0700
  21. state: directory
  22. - name: keyfile
  23. copy:
  24. content: "{{ item.key }}"
  25. dest: /ram/dmcrypt_devices/{{ item.name }}
  26. with_items: "{{ dmcrypt_devices }}"
  27. - name: luksFormat
  28. command:
  29. cryptsetup luksFormat
  30. --cipher {{ item.cipher }}
  31. --hash {{ item.hash }}
  32. --key-size {{ item.key_size }}
  33. {{ item.device }}
  34. /ram/dmcrypt_devices/{{ item.name }}
  35. with_items: "{{ dmcrypt_devices }}"
  36. - name: luksOpen
  37. command:
  38. cryptsetup luksOpen
  39. --key-file=/ram/dmcrypt_devices/{{ item.name }}
  40. {{ item.device }}
  41. {{ item.name }}
  42. with_items: "{{ dmcrypt_devices }}"
  43. - name: wipe keyfile
  44. command: shred /ram/dmcrypt_devices/{{ item.name }}
  45. with_items: "{{ dmcrypt_devices }}"
  46. - name: remove keyfile
  47. file:
  48. path: /ram/dmcrypt_devices/{{ item.name }}
  49. state: absent
  50. with_items: "{{ dmcrypt_devices }}"