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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. {%- set tplroot = tpldir.split('/')[0] %}
  2. {%- from tplroot ~ "/map.jinja" import salt_settings with context %}
  3. {%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
  4. salt-master:
  5. {% if salt_settings.install_packages %}
  6. pkg.installed:
  7. - name: {{ salt_settings.salt_master }}
  8. {%- if salt_settings.version is defined %}
  9. - version: {{ salt_settings.version }}
  10. {%- endif %}
  11. {% if salt_settings.master_service_details.state != 'ignore' %}
  12. - require_in:
  13. - service: salt-master
  14. - watch_in:
  15. - service: salt-master
  16. {% endif %}
  17. {% endif %}
  18. file.recurse:
  19. - name: {{ salt_settings.config_path }}/master.d
  20. {%- if salt_settings.master_config_use_TOFS %}
  21. - template: ''
  22. - source: {{ files_switch(['master.d'],
  23. lookup='salt-master'
  24. )
  25. }}
  26. {%- else %}
  27. - template: jinja
  28. - source: salt://{{ tplroot }}/files/master.d
  29. {%- endif %}
  30. - clean: {{ salt_settings.clean_config_d_dir }}
  31. - exclude_pat: _*
  32. {% if salt_settings.master_service_details.state != 'ignore' %}
  33. service.{{ salt_settings.master_service_details.state }}:
  34. - enable: {{ salt_settings.master_service_details.enabled }}
  35. - name: {{ salt_settings.master_service }}
  36. - watch:
  37. - file: salt-master
  38. - file: remove-old-master-conf-file
  39. {% endif %}
  40. {% if salt_settings.master_remove_config %}
  41. remove-default-master-conf-file:
  42. file.absent:
  43. - name: {{ salt_settings.config_path }}/master
  44. {% endif %}
  45. # clean up old _defaults.conf file if they have it around
  46. remove-old-master-conf-file:
  47. file.absent:
  48. - name: {{ salt_settings.config_path }}/master.d/_defaults.conf