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.

43 satır
1.0KB

  1. {%- from "salt/map.jinja" import master with context %}
  2. {%- if master.enabled %}
  3. {{ formula_dict }}
  4. {%- for environment_name, environment in master.get('environment', {}).iteritems() %}
  5. {%- if master.base_environment == environment_name %}
  6. {%- set formula_dict = environment.get('formula', {}) %}
  7. {%- set new_formula_dict = {} %}
  8. {%- for formula_name, formula in formula_dict.iteritems() %}
  9. {%- set _tmp = new_formula_dict.update({formula_name: formula.get('orchestrate_order', 100)}) %}
  10. {%- endfor %}
  11. {%- set sorted_formula_list = new_formula_dict|dictsort(false, 'value') %}
  12. {%- for formula in sorted_formula_list %}
  13. {%- if salt['file.file_exists']('/srv/salt/env/'+environment_name+'/'+formula.0+'/orchestrate.sls') %}
  14. {{ salt['cmd.run']('cat /srv/salt/env/'+environment_name+'/'+formula.0+'/orchestrate.sls') }}
  15. {%- else %}
  16. {{ formula.0 }}:
  17. salt.state:
  18. - tgt: 'services:{{ formula.0 }}'
  19. - tgt_type: grain
  20. - sls: {{ formula.0 }}
  21. {%- endif %}
  22. {%- endfor %}
  23. {%- endif %}
  24. {%- endfor %}
  25. {%- endif %}