New version of salt-formula from Saltstack
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 %}