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 години
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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 dir in formulas.get(env, []) -%}
  26. {%- set basedir = formulas_git_opt(env, 'basedir')|load_yaml -%}
  27. {%- do value.append('{0}/{1}'.format(basedir, dir)) -%}
  28. {%- endfor -%}
  29. {{ value|yaml }}
  30. {%- endmacro -%}
  31. {# Generate file_roots config merging standard salt config and list of
  32. enabled formulas #}
  33. {%- macro file_roots(input) -%}
  34. {%- set processed_envs = [] -%}
  35. file_roots:
  36. {%- for name, roots in input|dictsort -%}
  37. {%- do processed_envs.append(name) %}
  38. {{ name }}:
  39. {%- for dir in roots %}
  40. - {{ dir }}
  41. {%- endfor -%}
  42. {%- for dir in formulas_roots(name)|load_yaml %}
  43. - {{ dir }}
  44. {%- endfor -%}
  45. {%- endfor -%}
  46. {%- for name in formulas -%}
  47. {%- if name not in processed_envs %}
  48. {{ name }}:
  49. {%- for dir in formulas_roots(name)|load_yaml %}
  50. - {{ dir }}
  51. {%- endfor -%}
  52. {%- endif -%}
  53. {%- endfor -%}
  54. {%- endmacro -%}