Saltstack Official Salt Formula
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

formulas.jinja 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. {%- if value is mapping -%}
  14. {{ value|yaml }}
  15. {%- else -%}
  16. {{ value }}
  17. {%- endif -%}
  18. {%- endmacro -%}
  19. {%- macro formulas_roots(env) -%}
  20. {%- set value = [] -%}
  21. {%- for dir in formulas.get(env, []) -%}
  22. {%- do value.append('{0}/{1}'.format(formulas_git_opt(env, 'basedir'), dir)) -%}
  23. {%- endfor -%}
  24. {{ value|yaml }}
  25. {%- endmacro -%}
  26. {# Generate file_roots config merging standard salt config and list of
  27. enabled formulas #}
  28. {%- macro file_roots(input) -%}
  29. {%- set processed_envs = [] -%}
  30. file_roots:
  31. {%- for name, roots in input|dictsort -%}
  32. {%- do processed_envs.append(name) %}
  33. {{ name }}:
  34. {%- for dir in roots %}
  35. - {{ dir }}
  36. {%- endfor -%}
  37. {%- for dir in formulas_roots(name)|load_yaml %}
  38. - {{ dir }}
  39. {%- endfor -%}
  40. {%- endfor -%}
  41. {%- for name in formulas -%}
  42. {%- if name not in processed_envs %}
  43. {{ name }}:
  44. {%- for dir in formulas_roots(name)|load_yaml %}
  45. - {{ dir }}
  46. {%- endfor -%}
  47. {%- endif -%}
  48. {%- endfor -%}
  49. {%- endmacro -%}