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.

88 line
1.9KB

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