New version of salt-formula from Saltstack
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

84 lines
1.8KB

  1. {%- from "salt/map.jinja" import master with context %}
  2. {%- if master.enabled %}
  3. {%- if master.pillar.engine == 'salt' %}
  4. include:
  5. {%- if master.pillar.source.engine == "git" %}
  6. - git.client
  7. {%- endif %}
  8. - salt.master.service
  9. {%- if master.pillar.source.engine == "git" %}
  10. {{ master.pillar.source.address }}:
  11. git.latest:
  12. - target: /srv/salt/pillar
  13. - rev: {{ master.pillar.source.branch }}
  14. - require:
  15. - file: /srv/salt/env
  16. - pkg: git_packages
  17. {%- if master.system is defined %}
  18. /srv/salt/env/{{ master.system.environment }}/top.sls:
  19. file.symlink:
  20. - target: /srv/salt/pillar/files_top.sls
  21. - require:
  22. - file: /srv/salt/env/{{ master.system.environment }}
  23. {%- endif %}
  24. {%- endif %}
  25. {%- elif master.pillar.engine == 'reclass' %}
  26. include:
  27. - reclass.storage.data
  28. /srv/salt/reclass/classes/service:
  29. file.directory:
  30. - makedirs: True
  31. {%- if master.system is defined %}
  32. {%- for formula_name, formula in master.system.get('formula', {}).iteritems() %}
  33. /srv/salt/reclass/classes/service/{{ formula_name }}:
  34. file.symlink:
  35. - target: /srv/salt/env/{{ master.system.environment }}/{{ formula_name }}/metadata/service
  36. - require:
  37. - file: /srv/salt/reclass/classes/service
  38. {%- endfor %}
  39. {%- else %}
  40. {%- for environment_name, environment in master.environment.iteritems() %}
  41. {%- for formula_name, formula in environment.get('formula', {}).iteritems() %}
  42. {%- if environment_name == master.base_environment %}
  43. /srv/salt/reclass/classes/service/{{ formula_name }}:
  44. file.symlink:
  45. {%- if formula.source == 'pkg' %}
  46. - target: /usr/share/salt-formulas/reclass/service/{{ formula_name }}
  47. {%- else %}
  48. - target: /usr/share/salt-formulas/env/_formulas/{{ formula_name }}/metadata/service
  49. {%- endif %}
  50. - require:
  51. - file: /srv/salt/reclass/classes/service
  52. {%- endif %}
  53. {%- endfor %}
  54. {%- endfor %}
  55. {%- endif %}
  56. {%- endif %}
  57. {%- endif %}