Saltstack Official Salt Formula
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

46 lines
1.4KB

  1. {% set processed_gitdirs = [] %}
  2. {% set processed_basedirs = [] %}
  3. {% from "salt/formulas.jinja" import formulas_git_opt with context %}
  4. # Loop over all formulas listed in pillar data
  5. {% for env, entries in salt['pillar.get']('salt_formulas:list', {}).items() %}
  6. {% for entry in entries %}
  7. {% set basedir = formulas_git_opt(env, 'basedir')|load_yaml %}
  8. {% set gitdir = '{0}/{1}'.format(basedir, entry) %}
  9. {% set update = formulas_git_opt(env, 'update')|load_yaml %}
  10. # Setup the directory hosting the Git repository
  11. {% if basedir not in processed_basedirs %}
  12. {% do processed_basedirs.append(basedir) %}
  13. {{ basedir }}:
  14. file.directory:
  15. {%- for key, value in salt['pillar.get']('salt_formulas:basedir_opts',
  16. {'makedirs': True}).items() %}
  17. - {{ key }}: {{ value }}
  18. {%- endfor %}
  19. {% endif %}
  20. # Setup the formula Git repository
  21. {% if gitdir not in processed_gitdirs %}
  22. {% do processed_gitdirs.append(gitdir) %}
  23. {% set options = formulas_git_opt(env, 'options')|load_yaml %}
  24. {% set baseurl = formulas_git_opt(env, 'baseurl')|load_yaml %}
  25. {{ gitdir }}:
  26. git.latest:
  27. - name: {{ baseurl }}/{{ entry }}.git
  28. - target: {{ gitdir }}
  29. {%- for key, value in options.items() %}
  30. - {{ key }}: {{ value }}
  31. {%- endfor %}
  32. - require:
  33. - file: {{ basedir }}
  34. {%- if not update %}
  35. - unless: test -e {{ gitdir }}
  36. {%- endif %}
  37. {% endif %}
  38. {% endfor %}
  39. {% endfor %}