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.

57 lines
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'] %}
  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. {%- set install_xfs = True %}
  14. - require:
  15. - pkg: xfs_packages
  16. {%- endif %}
  17. {%- endif %}
  18. {{ mount.path }}:
  19. mount.mounted:
  20. - device: {{ mount.device }}
  21. - fstype: {{ mount.file_system }}
  22. - mkmnt: True
  23. - opts: {{ mount.get('opts', 'defaults,noatime') }}
  24. {%- if mount.file_system == 'xfs' %}
  25. - require:
  26. - pkg: xfs_packages
  27. {%- endif %}
  28. {%- if mount.user is defined %}
  29. {{ mount.path }}_permissions:
  30. file.directory:
  31. - name: {{ mount.path }}
  32. - user: {{ mount.user }}
  33. - group: {{ mount.get('group', 'root') }}
  34. - mode: {{ mount.get('mode', 755) }}
  35. - require:
  36. - mount: {{ mount.path }}
  37. {%- endif %}
  38. {%- endif %}
  39. {%- endfor %}
  40. {%- if install_xfs is defined %}
  41. xfs_packages:
  42. pkg.installed:
  43. - name: xfsprogs
  44. {%- endif %}
  45. {%- endif %}