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.

48 satır
1.4KB

  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. - require_in:
  12. - service: salt-master
  13. - watch_in:
  14. - service: salt-master
  15. {% endif %}
  16. file.recurse:
  17. - name: {{ salt_settings.config_path }}/master.d
  18. {%- if salt_settings.master_config_use_TOFS %}
  19. - template: ''
  20. - source: {{ files_switch(['master.d'],
  21. lookup='salt-master'
  22. )
  23. }}
  24. {%- else %}
  25. - template: jinja
  26. - source: salt://{{ tplroot }}/files/master.d
  27. {%- endif %}
  28. - clean: {{ salt_settings.clean_config_d_dir }}
  29. - exclude_pat: _*
  30. service.running:
  31. - enable: True
  32. - name: {{ salt_settings.master_service }}
  33. - watch:
  34. - file: salt-master
  35. - file: remove-old-master-conf-file
  36. {% if salt_settings.master_remove_config %}
  37. remove-default-master-conf-file:
  38. file.absent:
  39. - name: {{ salt_settings.config_path }}/master
  40. {% endif %}
  41. # clean up old _defaults.conf file if they have it around
  42. remove-old-master-conf-file:
  43. file.absent:
  44. - name: {{ salt_settings.config_path }}/master.d/_defaults.conf