Saltstack Official Linux Formula
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.

63 satır
1.5KB

  1. {%- from "linux/map.jinja" import storage with context %}
  2. {%- if storage.enabled %}
  3. {%- for name, mount in storage.mount|dictsort %}
  4. {%- if mount.enabled %}
  5. {%- if not mount.file_system in ['nfs', 'nfs4', 'cifs', 'tmpfs', 'none'] %}
  6. mkfs_{{ mount.device}}:
  7. cmd.run:
  8. - name: "mkfs.{{ mount.file_system }} -L {{ name }} {{ mount.device }}"
  9. - onlyif: "test `blkid {{ mount.device }} | grep -q TYPE;echo $?` -eq 1"
  10. - require_in:
  11. - mount: {{ mount.path }}
  12. {%- if mount.file_system == 'xfs' %}
  13. - require:
  14. - pkg: xfs_packages_{{ mount.device }}
  15. xfs_packages_{{ mount.device }}:
  16. pkg.installed:
  17. - name: xfsprogs
  18. {%- endif %}
  19. {%- endif %}
  20. {%- if mount.file_system == 'nfs' %}
  21. linux_storage_nfs_packages_{{ mount.path }}:
  22. pkg.installed:
  23. - pkgs: {{ storage.nfs.pkgs | json }}
  24. {%- endif %}
  25. {{ mount.path }}:
  26. mount.mounted:
  27. - order: 1
  28. - device: {{ mount.device }}
  29. - fstype: {{ mount.file_system }}
  30. - mkmnt: True
  31. - opts: {{ mount.get('opts', 'defaults,noatime') }}
  32. - dump: {{ mount.dump|default('0', true) }}
  33. - pass_num: {{ mount.pass_num|default('0', true) }}
  34. {%- if mount.file_system == 'xfs' %}
  35. - require:
  36. - pkg: xfs_packages_{{ mount.device }}
  37. {%- endif %}
  38. {%- if mount.user is defined %}
  39. {{ mount.path }}_permissions:
  40. file.directory:
  41. - name: {{ mount.path }}
  42. - user: {{ mount.user }}
  43. - group: {{ mount.get('group', 'root') }}
  44. - mode: {{ mount.get('mode', 755) }}
  45. - require:
  46. - mount: {{ mount.path }}
  47. {%- endif %}
  48. {%- endif %}
  49. {%- endfor %}
  50. {%- endif %}