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.

config.sls 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839
  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 %}