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

69 行
2.1KB

  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 grains.os == 'MacOS' %}
  5. salt-master-macos:
  6. file.managed:
  7. - name: /Library/LaunchDaemons/com.saltstack.salt.master.plist
  8. - source: https://raw.githubusercontent.com/saltstack/salt/master/pkg/darwin/com.saltstack.salt.master.plist
  9. - source_hash: {{ salt_settings.salt_master_macos_plist_hash }}
  10. - retry:
  11. attempts: 2
  12. until: True
  13. interval: 10
  14. splay: 10
  15. cmd.run:
  16. - names:
  17. - launchctl load -w /Library/LaunchDaemons/com.saltstack.salt.master.plist
  18. - launchctl unload /Library/LaunchDaemons/com.saltstack.salt.master.plist
  19. - require:
  20. - file: salt-master-macos
  21. - require_in:
  22. - service: salt-master
  23. {%- endif %}
  24. salt-master:
  25. {% if salt_settings.install_packages %}
  26. pkg.installed:
  27. - name: {{ salt_settings.salt_master }}
  28. {%- if salt_settings.version is defined %}
  29. - version: {{ salt_settings.version }}
  30. {%- endif %}
  31. - require_in:
  32. - service: salt-master
  33. - watch_in:
  34. - service: salt-master
  35. {% endif %}
  36. file.recurse:
  37. - name: {{ salt_settings.config_path }}/master.d
  38. {%- if salt_settings.master_config_use_TOFS %}
  39. - template: ''
  40. - source: {{ files_switch(['master.d'],
  41. lookup='salt-master'
  42. )
  43. }}
  44. {%- else %}
  45. - template: jinja
  46. - source: salt://{{ slspath }}/files/master.d
  47. {%- endif %}
  48. - clean: {{ salt_settings.clean_config_d_dir }}
  49. - exclude_pat: _*
  50. service.running:
  51. - enable: True
  52. - name: {{ salt_settings.master_service }}
  53. - watch:
  54. - file: salt-master
  55. - file: remove-old-master-conf-file
  56. {% if salt_settings.master_remove_config %}
  57. remove-default-master-conf-file:
  58. file.absent:
  59. - name: {{ salt_settings.config_path }}/master
  60. {% endif %}
  61. # clean up old _defaults.conf file if they have it around
  62. remove-old-master-conf-file:
  63. file.absent:
  64. - name: {{ salt_settings.config_path }}/master.d/_defaults.conf