init.sls 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #
  2. # Rsyslog configuration
  3. #
  4. {% set roles = salt['pillar.get'] ('nodes:' ~ grains['id'] ~ ':roles') %}
  5. rsyslog:
  6. pkg.installed:
  7. - name: rsyslog
  8. service.running:
  9. - enable: True
  10. /etc/rsyslog-early.d:
  11. file.recurse:
  12. - source: salt://rsyslog/rsyslog-early.d
  13. - user: root
  14. - group: root
  15. - file_mode: 644
  16. - dir_mode: 755
  17. - clean: true
  18. - watch_in:
  19. - service: rsyslog
  20. /etc/rsyslog.conf:
  21. file.managed:
  22. - watch_in:
  23. - service: rsyslog
  24. {% if 'logserver' in roles %}
  25. - source: salt://rsyslog/rsyslog.conf.logserver
  26. {% else %}
  27. - source: salt://rsyslog/rsyslog.conf
  28. {% endif %}
  29. #
  30. # Install filter rules everywhere so we have the same log layout everywhere
  31. # and avoid logging stuff (kernel log, dhcpd, ...) multiple times (daemon.log,
  32. # message, syslog) on every node.
  33. #
  34. /etc/rsyslog.d/ffho.conf:
  35. file.managed:
  36. - source: salt://rsyslog/ffho.conf
  37. - watch_in:
  38. - service: rsyslog
  39. - require:
  40. - file: /etc/rsyslog.d/ffho
  41. /etc/rsyslog.d/ffho:
  42. file.recurse:
  43. - source: salt://rsyslog/ffho
  44. - file_mode: 644
  45. - dir_mode: 755
  46. - user: root
  47. - group: root
  48. - clean: true
  49. - watch_in:
  50. - service: rsyslog
  51. /etc/logrotate.d/ffho:
  52. file.managed:
  53. - source: salt://rsyslog/ffho.logrotate
  54. {% if 'logserver' in roles %}
  55. /etc/rsyslog.d/zz-debug.conf:
  56. file.managed:
  57. - source: salt://rsyslog/zz-debug.conf
  58. - watch_in:
  59. - service: rsyslog
  60. {% endif %}