New version of salt-formula from Saltstack
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.

85 lines
1.9KB

  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. - require:
  31. - file: reclass_data_dir
  32. {%- if master.system is defined %}
  33. {%- for formula_name, formula in master.system.get('formula', {}).iteritems() %}
  34. /srv/salt/reclass/classes/service/{{ formula_name }}:
  35. file.symlink:
  36. - target: /srv/salt/env/{{ master.system.environment }}/{{ formula_name }}/metadata/service
  37. - require:
  38. - file: /srv/salt/reclass/classes/service
  39. {%- endfor %}
  40. {%- else %}
  41. {%- for environment_name, environment in master.environment.iteritems() %}
  42. {%- for formula_name, formula in environment.get('formula', {}).iteritems() %}
  43. {%- if environment_name == master.base_environment %}
  44. /srv/salt/reclass/classes/service/{{ formula_name }}:
  45. file.symlink:
  46. {%- if formula.source == 'pkg' %}
  47. - target: /usr/share/salt-formulas/reclass/service/{{ formula_name }}
  48. {%- else %}
  49. - target: /usr/share/salt-formulas/env/_formulas/{{ formula_name }}/metadata/service
  50. {%- endif %}
  51. - require:
  52. - file: /srv/salt/reclass/classes/service
  53. {%- endif %}
  54. {%- endfor %}
  55. {%- endfor %}
  56. {%- endif %}
  57. {%- endif %}
  58. {%- endif %}