Saltstack Official Salt Formula
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

49 行
1.3KB

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