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.

68 line
1.9KB

  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. {%- if file.defaults is defined %}
  27. - defaults: {{ file.defaults|json }}
  28. {%- endif %}
  29. {%- if file.context is defined %}
  30. - context: {{ file.context|json }}
  31. {%- endif %}
  32. {%- endif %}
  33. {%- elif file.contents is defined %}
  34. - contents: {{ file.contents|json }}
  35. {%- elif file.contents_pillar is defined %}
  36. - contents_pillar: {{ file.contents_pillar }}
  37. {%- elif file.contents_grains is defined %}
  38. - contents_grains: {{ file.contents_grains }}
  39. {%- endif %}
  40. {%- endif %}
  41. {%- if file.name is defined %}
  42. - name: {{ file.name }}
  43. {%- else %}
  44. - name: {{ file_name }}
  45. {%- endif %}
  46. - makedirs: {{ file.get('makedirs', 'True') }}
  47. - replace: {{ file.get('replace', 'True') }}
  48. - user: {{ file.get('user', 'root') }}
  49. - group: {{ file.get('group', 'root') }}
  50. {%- if file.mode is defined %}
  51. - mode: {{ file.mode }}
  52. {%- endif %}
  53. {%- if file.dir_mode is defined %}
  54. - dir_mode: {{ file.dir_mode }}
  55. {%- endif %}
  56. {%- if file.encoding is defined %}
  57. - encoding: {{ file.encoding }}
  58. {%- endif %}
  59. {%- endfor %}
  60. {%- endif %}