Saltstack Official Linux Formula
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

40 lines
1.6KB

  1. {%- from "linux/map.jinja" import system with context %}
  2. {%- macro load_support_file(file, pillar, grains) %}{% include file %}{% endmacro %}
  3. {%- if system.enabled %}
  4. {%- for config_name, config in system.get('config', {}).items() %}
  5. {%- if config.enabled|default(True) %}
  6. {%- for service_name in config.pillar.keys() %}
  7. {%- if pillar.get(service_name, {}).get('_support', {}).get('config', {}).get('enabled', False) %}
  8. {%- set support_fragment_file = service_name+'/meta/config.yml' %}
  9. {%- set service_config_files = load_support_file(support_fragment_file, config.pillar, config.get('grains', {}))|load_yaml %}
  10. {%- for service_config_name, service_config in service_config_files.config.items() %}
  11. {{ service_config.path }}:
  12. file.managed:
  13. - source: {{ service_config.source }}
  14. - user: {{ config.get('user', service_config.get('user', 'root')) }}
  15. - group: {{ config.get('group', service_config.get('group', 'root')) }}
  16. - mode: {{ config.get('mode', service_config.get('mode', '644')) }}
  17. {%- if service_config.template is defined %}
  18. - template: {{ service_config.template }}
  19. {%- endif %}
  20. - makedirs: true
  21. - defaults:
  22. pillar: {{ config.pillar|yaml }}
  23. grains: {{ config.get('grains', {}) }}
  24. {%- for key, value in service_config.get('defaults', {}).items() %}
  25. {{ key }}: {{ value }}
  26. {%- endfor %}
  27. {%- endfor %}
  28. {%- endif %}
  29. {%- endfor %}
  30. {%- else %}
  31. {# TODO: configmap not using support between formulas #}
  32. {%- endif %}
  33. {%- endfor %}
  34. {%- endif %}