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.

53 lines
1.5KB

  1. {%- from "linux/map.jinja" import system with context %}
  2. {%- if system.enabled %}
  3. {%- for file_name, file in system.file.items() %}
  4. linux_file_{{ file_name }}:
  5. {%- if file.serialize is defined %}
  6. file.serialize:
  7. - formatter: {{ file.serialize }}
  8. {%- if file.contents is defined %}
  9. - dataset: {{ file.contents|yaml }}
  10. {%- elif file.contents_pillar is defined %}
  11. - dataset_pillar: {{ file.contents_pillar }}
  12. {%- endif %}
  13. {%- else %}
  14. file.managed:
  15. {%- if file.source is defined %}
  16. - source: {{ file.source }}
  17. {%- if file.hash is defined %}
  18. - source_hash: {{ file.hash }}
  19. {%- else %}
  20. - skip_verify: True
  21. {%- endif %}
  22. {%- elif file.contents is defined %}
  23. - contents: {{ file.contents|yaml }}
  24. {%- elif file.contents_pillar is defined %}
  25. - contents_pillar: {{ file.contents_pillar }}
  26. {%- elif file.contents_grains is defined %}
  27. - contents_grains: {{ file.contents_grains }}
  28. {%- endif %}
  29. {%- endif %}
  30. {%- if file.name is defined %}
  31. - name: {{ file.name }}
  32. {%- else %}
  33. - name: {{ file_name }}
  34. {%- endif %}
  35. - makedirs: {{ file.get('makedirs', 'True') }}
  36. - user: {{ file.get('user', 'root') }}
  37. - group: {{ file.get('group', 'root') }}
  38. {%- if file.mode is defined %}
  39. - mode: {{ file.mode }}
  40. {%- endif %}
  41. {%- if file.dir_mode is defined %}
  42. - dir_mode: {{ file.dir_mode }}
  43. {%- endif %}
  44. {%- if file.encoding is defined %}
  45. - encoding: {{ file.encoding }}
  46. {%- endif %}
  47. {%- endfor %}
  48. {%- endif %}