init.sls 1.7 KB

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