Saltstack Official Linux Formula
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

60 lines
1.4KB

  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'] %}
  6. mkfs_{{ mount.device}}:
  7. cmd.run:
  8. - name: "mkfs.{{ mount.file_system }} -L {{ name }} {{ mount.device }}"
  9. - onlyif: "test `blkid {{ mount.device }} >/dev/null;echo $?` -eq 2"
  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:
  22. pkg.installed:
  23. - pkgs: {{ storage.nfs.pkgs }}
  24. {%- endif %}
  25. {{ mount.path }}:
  26. mount.mounted:
  27. - device: {{ mount.device }}
  28. - fstype: {{ mount.file_system }}
  29. - mkmnt: True
  30. - opts: {{ mount.get('opts', 'defaults,noatime') }}
  31. {%- if mount.file_system == 'xfs' %}
  32. - require:
  33. - pkg: xfs_packages_{{ mount.device }}
  34. {%- endif %}
  35. {%- if mount.user is defined %}
  36. {{ mount.path }}_permissions:
  37. file.directory:
  38. - name: {{ mount.path }}
  39. - user: {{ mount.user }}
  40. - group: {{ mount.get('group', 'root') }}
  41. - mode: {{ mount.get('mode', 755) }}
  42. - require:
  43. - mount: {{ mount.path }}
  44. {%- endif %}
  45. {%- endif %}
  46. {%- endfor %}
  47. {%- endif %}