init.sls 1.6 KB

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