Saltstack Official Linux 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.

atop.sls 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. {%- from "linux/map.jinja" import system with context %}
  2. {%- if system.atop.enabled %}
  3. atop_packages:
  4. pkg.installed:
  5. - name: atop
  6. atop_defaults:
  7. file.managed:
  8. - name: /etc/default/atop
  9. - source: salt://linux/files/atop.conf
  10. - template: jinja
  11. - user: root
  12. - group: root
  13. - mode: 644
  14. atop_logpath:
  15. file.directory:
  16. - name: {{ system.atop.logpath }}
  17. - user: root
  18. - group: root
  19. - mode: 750
  20. - makedirs: true
  21. {%- if grains.get('init', None) == 'systemd' %}
  22. atop_systemd_file:
  23. file.managed:
  24. - name: /etc/systemd/system/atop.service
  25. - source: salt://linux/files/atop.service
  26. - user: root
  27. - mode: 644
  28. - defaults:
  29. service_name: atop
  30. config_file: /etc/default/atop
  31. autostart: {{ system.atop.autostart }}
  32. - template: jinja
  33. - require_in:
  34. - service: atop_service
  35. {%- endif %}
  36. atop_service:
  37. service.running:
  38. - name: atop
  39. - enable: {{ system.atop.autostart }}
  40. - watch:
  41. - file: atop_defaults
  42. {%- if grains.get('noservices') %}
  43. - onlyif: /bin/false
  44. {%- endif %}
  45. {%- else %}
  46. atop_service_stop:
  47. service.dead:
  48. - name: atop
  49. - enable: false
  50. - require_in:
  51. - pkg: atop_pkg_purge
  52. {%- if grains.get('noservices') %}
  53. - onlyif: /bin/false
  54. {%- endif %}
  55. atop_defaults_purge:
  56. file.absent:
  57. - names:
  58. - /etc/default/atop
  59. - /etc/systemd/system/atop.service
  60. - require:
  61. - pkg: atop_pkg_purge
  62. atop_pkg_purge:
  63. pkg.purged:
  64. - name: atop
  65. {%- endif %}