您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

67 行
1.9KB

  1. ---
  2. - name: install debian packages
  3. apt:
  4. pkg: "{{item}}"
  5. state: installed
  6. when: ansible_os_family=="Debian"
  7. with_items:
  8. - btrfs-tools
  9. - dosfstools
  10. - name: unmount filesystems
  11. mount:
  12. name: "{{ root_target_directory | default('') }}/{{ item.mount_point }}"
  13. state: unmounted
  14. with_items: "{{ filesystems[::-1] }}"
  15. when:
  16. filesystems_state == "unmounted" or
  17. filesystems_state == "formated"
  18. - name: filesystems
  19. filesystem:
  20. fstype: "{{ item.fstype }}"
  21. dev: "{{ item.device }}"
  22. opts: -U {{ item.uuid }}
  23. force: "{{ filesystems_state == 'formated' }}"
  24. with_items: "{{ filesystems }}"
  25. when:
  26. item.device is defined and (
  27. filesystems_state == "mounted" or
  28. filesystems_state == "formated" ) and
  29. not item.fstype == "vfat"
  30. - name: format fat32
  31. command: mkfs.fat -F32 {{ item.device }}
  32. with_items: "{{ filesystems }}"
  33. when:
  34. item.device is defined and
  35. filesystems_state == "formated" and
  36. item.fstype == "vfat"
  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"