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.

24 lines
1.4KB

  1. {%- from "salt/map.jinja" import master with context %}
  2. {%- if master.enabled %}
  3. {%- for environment_name, environment in master.get('environment', {}).iteritems() %}
  4. {%- set formulas = environment.get('formula', {}) %}
  5. {%- set priorities = {'orchestration':{'deploy':{'applications':{}}, 'upgrade': {'applications': {}}}} %}
  6. {%- for formula_name, formula in formulas.iteritems() %}
  7. {%- if salt['file.file_exists'](master.dir.files+'/'+environment_name+'/'+formula_name+'/meta/salt.yml') %}
  8. {%- set orch_fragment_file = formula_name+'/meta/salt.yml' %}
  9. {%- macro load_orch_file() %}{% include orch_fragment_file %}{% endmacro %}
  10. {%- set orch_yaml = load_orch_file()|load_yaml %}
  11. {%- if orch_yaml.orchestration is defined %}
  12. {%- if orch_yaml.orchestration.deploy is defined %}
  13. {%- do priorities['orchestration']['deploy']['applications'].update({ formula_name: orch_yaml['orchestration']['deploy']['applications'][formula_name] }) %}
  14. {%- endif %}
  15. {%- if orch_yaml.orchestration.upgrade is defined %}
  16. {%- do priorities['orchestration']['upgrade']['applications'].update({ formula_name: orch_yaml['orchestration']['upgrade']['applications'][formula_name] }) %}
  17. {%- endif %}
  18. {%- endif %}
  19. {%- endif %}
  20. {%- endfor %}
  21. {{ priorities|yaml(False) }}
  22. {%- endfor %}
  23. {%- endif %}