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.

67 lines
1.9KB

  1. ---
  2. - name: install debian packages
  3. apt:
  4. pkg:
  5. - btrfs-progs
  6. - dosfstools
  7. when: ansible_os_family == "Debian"
  8. - name: unmount filesystems
  9. mount:
  10. name: "{{ root_target_directory | default('') }}/{{ item.mount_point }}"
  11. state: unmounted
  12. with_items: "{{ filesystems[::-1] }}"
  13. when:
  14. filesystems_state == "unmounted" or
  15. filesystems_state == "formated"
  16. - name: filesystems
  17. filesystem:
  18. fstype: "{{ item.fstype }}"
  19. dev: "{{ item.device }}"
  20. opts: -U {{ item.uuid }}
  21. force: "{{ filesystems_state == 'formated' }}"
  22. with_items: "{{ filesystems }}"
  23. when:
  24. - item.device is defined
  25. - filesystems_state == "mounted" or
  26. filesystems_state == "formated"
  27. - not item.fstype == "vfat"
  28. - not (item.keep is defined and item.keep)
  29. - name: format fat32
  30. command: mkfs.fat -F32 {{ item.device }}
  31. with_items: "{{ filesystems }}"
  32. when:
  33. - item.device is defined
  34. - filesystems_state == "formated"
  35. - item.fstype == "vfat"
  36. - not (item.keep is defined and item.keep)
  37. - name: mount filesystems
  38. mount:
  39. name: "{{ root_target_directory | default('') }}{{ root_target_directory is defined | ternary('/','') }}{{ item.mount_point }}"
  40. src: "{{ (item.uuid is defined | ternary('UUID=','')) + item.uuid | default(item.device) }}"
  41. fstype: "{{ item.fstype }}"
  42. opts: '{{ item.mount_options | default("defaults") }}'
  43. state: mounted
  44. with_items: "{{ filesystems }}"
  45. when:
  46. filesystems_state == "mounted" or
  47. filesystems_state == "formated"
  48. - name: fstab
  49. mount:
  50. name: "{{ item.mount_point }}"
  51. src: "{{ (item.uuid is defined | ternary('UUID=','')) + item.uuid | default(item.device) }}"
  52. fstype: "{{ item.fstype }}"
  53. opts: "{{ item.opts | default('defaults') }}"
  54. state: present
  55. fstab: "{{ fstab_file }}"
  56. with_items: "{{ filesystems }}"
  57. when:
  58. filesystems_state == "configured" or
  59. filesystems_state == "mounted" or
  60. filesystems_state == "formated"