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.

107 line
2.4KB

  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 == 'architect' %}
  26. salt_pillar_architect_package:
  27. pip.installed:
  28. - name: architect-client
  29. salt_pillar_architect_package_config_dir:
  30. file.directory:
  31. - name: /etc/architect
  32. salt_pillar_architect_package_config_file:
  33. file.managed:
  34. - name: /etc/architect/client.yml
  35. - source: salt://salt/files/architect.yml
  36. - user: root
  37. - template: jinja
  38. - require:
  39. - file: salt_pillar_architect_package_config_dir
  40. {%- elif master.pillar.engine == 'reclass' %}
  41. include:
  42. - reclass.storage.data
  43. /srv/salt/reclass/classes/service:
  44. file.directory:
  45. - makedirs: true
  46. - require:
  47. - file: reclass_data_dir
  48. {%- if master.system is defined %}
  49. {%- for formula_name, formula in master.system.get('formula', {}).iteritems() %}
  50. /srv/salt/reclass/classes/service/{{ formula_name }}:
  51. file.symlink:
  52. - makedirs: true
  53. - target: /srv/salt/env/{{ master.system.environment }}/{{ formula_name }}/metadata/service
  54. - require:
  55. - file: /srv/salt/reclass/classes/service
  56. {%- endfor %}
  57. {%- else %}
  58. {%- for environment_name, environment in master.get('environment', {}).iteritems() %}
  59. {%- for formula_name, formula in environment.get('formula', {}).iteritems() %}
  60. {%- if environment_name == master.base_environment %}
  61. /srv/salt/reclass/classes/service/{{ formula_name }}:
  62. file.symlink:
  63. - makedirs: true
  64. {%- if formula.source == 'pkg' %}
  65. - target: /usr/share/salt-formulas/reclass/service/{{ formula_name }}
  66. {%- else %}
  67. - target: /usr/share/salt-formulas/env/_formulas/{{ formula_name }}/metadata/service
  68. {%- endif %}
  69. - require:
  70. - file: /srv/salt/reclass/classes/service
  71. {%- endif %}
  72. {%- endfor %}
  73. {%- endfor %}
  74. {%- endif %}
  75. {%- endif %}
  76. {%- endif %}