Saltstack Official Salt Formula
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.

master.sls 2.5KB

11 jaren geleden
11 jaren geleden
5 jaren geleden
11 jaren geleden
11 jaren geleden
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. {%- if grains.os == 'MacOS' %}
  9. salt-master-macos:
  10. file.managed:
  11. - name: /Library/LaunchDaemons/com.saltstack.salt.master.plist
  12. - source: https://raw.githubusercontent.com/saltstack/salt/master/pkg/osx/scripts/com.saltstack.salt.master.plist
  13. - source_hash: {{ salt_settings.salt_master_macos_plist_hash }}
  14. - retry:
  15. attempts: 2
  16. until: True
  17. interval: 10
  18. splay: 10
  19. - require_in:
  20. - service: salt-master
  21. {%- endif %}
  22. salt-master:
  23. {% if salt_settings.install_packages %}
  24. pkg.installed:
  25. - name: {{ salt_settings.salt_master }}
  26. {%- if salt_settings.version is defined %}
  27. - version: {{ salt_settings.version }}
  28. {%- endif %}
  29. {% if salt_settings.master_service_details.state != 'ignore' %}
  30. - require_in:
  31. - service: salt-master
  32. - watch_in:
  33. - service: salt-master
  34. {% endif %}
  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://{{ tplroot }}/files/master.d
  47. {%- endif %}
  48. - clean: {{ salt_settings.clean_config_d_dir }}
  49. - exclude_pat: _*
  50. {% if salt_settings.master_service_details.state != 'ignore' %}
  51. service.{{ salt_settings.master_service_details.state }}:
  52. - enable: {{ salt_settings.master_service_details.enabled }}
  53. - name: {{ salt_settings.master_service }}
  54. - watch:
  55. {%- if grains.kernel|lower == 'darwin' %}
  56. - file: salt-master-macos
  57. {%- else %}
  58. - file: salt-master
  59. {%- endif %}
  60. - file: remove-old-master-conf-file
  61. - order: last
  62. {% endif %}
  63. {% if salt_settings.master_remove_config %}
  64. remove-default-master-conf-file:
  65. file.absent:
  66. - name: {{ salt_settings.config_path }}/master
  67. - watch_in:
  68. - service: salt-master
  69. {% endif %}
  70. # clean up old _defaults.conf file if they have it around
  71. remove-old-master-conf-file:
  72. file.absent:
  73. - name: {{ salt_settings.config_path }}/master.d/_defaults.conf