Saltstack Official Salt 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.

преди 9 години
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. {% set defaults = {
  2. 'baseurl': 'https://github.com/saltstack-formulas',
  3. 'basedir': '/srv/formulas',
  4. 'update': False,
  5. 'options': {},
  6. }
  7. %}
  8. {% set formulas = salt['pillar.get']('salt_formulas:list', {}) %}
  9. {%- macro formulas_git_opt(env, opt) -%}
  10. {%- set value = salt['pillar.get']('salt_formulas:git_opts:{0}:{1}'.format(env, opt),
  11. salt['pillar.get']('salt_formulas:git_opts:default:{0}'.format(opt),
  12. defaults[opt])) -%}
  13. {{ value|yaml }}
  14. {%- endmacro -%}
  15. {%- macro formulas_roots(env) -%}
  16. {%- set value = [] -%}
  17. {%- for dir in formulas.get(env, []) -%}
  18. {%- set basedir = formulas_git_opt(env, 'basedir')|load_yaml -%}
  19. {%- do value.append('{0}/{1}'.format(basedir, dir)) -%}
  20. {%- endfor -%}
  21. {{ value|yaml }}
  22. {%- endmacro -%}
  23. {# Generate file_roots config merging standard salt config and list of
  24. enabled formulas #}
  25. {%- macro file_roots(input) -%}
  26. {%- set processed_envs = [] -%}
  27. file_roots:
  28. {%- for name, roots in input|dictsort -%}
  29. {%- do processed_envs.append(name) %}
  30. {{ name }}:
  31. {%- for dir in roots %}
  32. - {{ dir }}
  33. {%- endfor -%}
  34. {%- for dir in formulas_roots(name)|load_yaml %}
  35. - {{ dir }}
  36. {%- endfor -%}
  37. {%- endfor -%}
  38. {%- for name in formulas -%}
  39. {%- if name not in processed_envs %}
  40. {{ name }}:
  41. {%- for dir in formulas_roots(name)|load_yaml %}
  42. - {{ dir }}
  43. {%- endfor -%}
  44. {%- endif -%}
  45. {%- endfor -%}
  46. {%- endmacro -%}