New version of salt-formula from Saltstack
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

76 lines
1.7KB

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