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

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