Saltstack Official Linux Formula
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

53 rindas
1.2KB

  1. {%- from "linux/map.jinja" import storage with context %}
  2. {%- if storage.enabled %}
  3. {%- for name, mount in storage.mount.iteritems() %}
  4. {%- if mount.enabled %}
  5. {%- if not mount.file_system in ['nfs', 'nfs4', 'cifs'] %}
  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. {{ mount.path }}:
  21. mount.mounted:
  22. - device: {{ mount.device }}
  23. - fstype: {{ mount.file_system }}
  24. - mkmnt: True
  25. - opts: {{ mount.get('opts', 'defaults,noatime') }}
  26. {%- if mount.file_system == 'xfs' %}
  27. - require:
  28. - pkg: xfs_packages_{{ mount.device }}
  29. {%- endif %}
  30. {%- if mount.user is defined %}
  31. {{ mount.path }}_permissions:
  32. file.directory:
  33. - name: {{ mount.path }}
  34. - user: {{ mount.user }}
  35. - group: {{ mount.get('group', 'root') }}
  36. - mode: {{ mount.get('mode', 755) }}
  37. - require:
  38. - mount: {{ mount.path }}
  39. {%- endif %}
  40. {%- endif %}
  41. {%- endfor %}
  42. {%- endif %}