Saltstack Official Salt Formula
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

47 rindas
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, elements in salt['pillar.get']('salt_formulas:list', {}).items() %}
  6. {% for baseurl, entries in elements.items() %}
  7. {% for entry in entries %}
  8. {% set basedir = formulas_git_opt(env, 'basedir')|load_yaml %}
  9. {% set gitdir = '{0}/{1}'.format(basedir, entry) %}
  10. {% set update = formulas_git_opt(env, 'update')|load_yaml %}
  11. # Setup the directory hosting the Git repository
  12. {% if basedir not in processed_basedirs %}
  13. {% do processed_basedirs.append(basedir) %}
  14. {{ basedir }}:
  15. file.directory:
  16. {%- for key, value in salt['pillar.get']('salt_formulas:basedir_opts',
  17. {'makedirs': True}).items() %}
  18. - {{ key }}: {{ value }}
  19. {%- endfor %}
  20. {% endif %}
  21. # Setup the formula Git repository
  22. {% if gitdir not in processed_gitdirs %}
  23. {% do processed_gitdirs.append(gitdir) %}
  24. {% set options = formulas_git_opt(env, 'options')|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 %}
  40. {% endfor %}