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

56 行
1.8KB

  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. {% if salt_settings.pin_version and salt_settings.version and grains.os_family|lower == 'debian' %}
  5. include:
  6. - .pin
  7. {% endif %}
  8. salt-master:
  9. {% if salt_settings.install_packages %}
  10. pkg.installed:
  11. - name: {{ salt_settings.salt_master }}
  12. {%- if salt_settings.version is defined %}
  13. - version: {{ salt_settings.version }}
  14. {%- endif %}
  15. {% if salt_settings.master_service_details.state != 'ignore' %}
  16. - require_in:
  17. - service: salt-master
  18. - watch_in:
  19. - service: salt-master
  20. {% endif %}
  21. {% endif %}
  22. file.recurse:
  23. - name: {{ salt_settings.config_path }}/master.d
  24. {%- if salt_settings.master_config_use_TOFS %}
  25. - template: ''
  26. - source: {{ files_switch(['master.d'],
  27. lookup='salt-master'
  28. )
  29. }}
  30. {%- else %}
  31. - template: jinja
  32. - source: salt://{{ tplroot }}/files/master.d
  33. {%- endif %}
  34. - clean: {{ salt_settings.clean_config_d_dir }}
  35. - exclude_pat: _*
  36. {% if salt_settings.master_service_details.state != 'ignore' %}
  37. service.{{ salt_settings.master_service_details.state }}:
  38. - enable: {{ salt_settings.master_service_details.enabled }}
  39. - name: {{ salt_settings.master_service }}
  40. - watch:
  41. - file: salt-master
  42. - file: remove-old-master-conf-file
  43. {% endif %}
  44. {% if salt_settings.master_remove_config %}
  45. remove-default-master-conf-file:
  46. file.absent:
  47. - name: {{ salt_settings.config_path }}/master
  48. {% endif %}
  49. # clean up old _defaults.conf file if they have it around
  50. remove-old-master-conf-file:
  51. file.absent:
  52. - name: {{ salt_settings.config_path }}/master.d/_defaults.conf