New version of salt-formula from Saltstack
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

service.sls 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. {%- from "salt/map.jinja" import minion with context %}
  2. {%- if minion.enabled %}
  3. {%- if minion.source.get('engine', 'pkg') == 'pkg' %}
  4. salt_minion_packages:
  5. pkg.latest:
  6. - names: {{ minion.pkgs }}
  7. {%- if minion.source.version is defined %}
  8. - version: {{ minion.source.version }}
  9. {%- endif %}
  10. salt_minion_dependency_packages:
  11. pkg.installed:
  12. - pkgs: {{ minion.dependency_pkgs }}
  13. {%- elif minion.source.get('engine', 'pkg') == 'pip' %}
  14. salt_minion_packages:
  15. pip.installed:
  16. - name: salt{% if minion.source.version is defined %}=={{ minion.source.version }}{% endif %}
  17. salt_minion_dependency_packages:
  18. pkg.installed:
  19. - pkgs: {{ minion.dependency_pkgs_pip }}
  20. {%- endif %}
  21. /etc/salt/minion.d/minion.conf:
  22. file.managed:
  23. - source: salt://salt/files/minion.conf
  24. - user: root
  25. - group: root
  26. - template: jinja
  27. - require:
  28. - {{ minion.install_state }}
  29. {%- if not grains.get('noservices', False) %}
  30. - watch_in:
  31. - service: salt_minion_service
  32. {%- endif %}
  33. {%- if not grains.get('noservices', False) %}
  34. salt_minion_service:
  35. service.running:
  36. - name: {{ minion.service }}
  37. - enable: true
  38. - require:
  39. - pkg: salt_minion_packages
  40. - pkg: salt_minion_dependency_packages
  41. {%- endif %}
  42. salt_minion_sync_all:
  43. module.run:
  44. - name: 'saltutil.sync_all'
  45. {%- if not grains.get('noservices', False) %}
  46. - watch:
  47. - service: salt_minion_service
  48. {%- endif %}
  49. - require:
  50. - pkg: salt_minion_packages
  51. - pkg: salt_minion_dependency_packages
  52. {%- endif %}