Saltstack Official Linux Formula
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

file.sls 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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.absent is defined and file.absent is sameas true %}
  6. file.absent:
  7. {%- elif file.serialize is defined %}
  8. file.serialize:
  9. - formatter: {{ file.serialize }}
  10. {%- if file.contents is defined %}
  11. - dataset: {{ file.contents|json }}
  12. {%- elif file.contents_pillar is defined %}
  13. - dataset_pillar: {{ file.contents_pillar }}
  14. {%- endif %}
  15. {%- else %}
  16. file.managed:
  17. {%- if file.source is defined %}
  18. - source: {{ file.source }}
  19. {%- if file.hash is defined %}
  20. - source_hash: {{ file.hash }}
  21. {%- else %}
  22. - skip_verify: True
  23. {%- endif %}
  24. {%- if file.template is defined %}
  25. - template: {{ file.template }}
  26. {%- endif %}
  27. {%- elif file.contents is defined %}
  28. - contents: {{ file.contents|json }}
  29. {%- elif file.contents_pillar is defined %}
  30. - contents_pillar: {{ file.contents_pillar }}
  31. {%- elif file.contents_grains is defined %}
  32. - contents_grains: {{ file.contents_grains }}
  33. {%- endif %}
  34. {%- endif %}
  35. {%- if file.name is defined %}
  36. - name: {{ file.name }}
  37. {%- else %}
  38. - name: {{ file_name }}
  39. {%- endif %}
  40. - makedirs: {{ file.get('makedirs', 'True') }}
  41. - replace: {{ file.get('replace', 'True') }}
  42. - user: {{ file.get('user', 'root') }}
  43. - group: {{ file.get('group', 'root') }}
  44. {%- if file.mode is defined %}
  45. - mode: {{ file.mode }}
  46. {%- endif %}
  47. {%- if file.dir_mode is defined %}
  48. - dir_mode: {{ file.dir_mode }}
  49. {%- endif %}
  50. {%- if file.encoding is defined %}
  51. - encoding: {{ file.encoding }}
  52. {%- endif %}
  53. {%- endfor %}
  54. {%- endif %}