init.sls 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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.directory:
  12. - user: root
  13. - group: root
  14. - mode: 0755
  15. /etc/rsyslog.conf:
  16. file.managed:
  17. - watch_in:
  18. - service: rsyslog
  19. {% if 'logserver' in roles %}
  20. - source: salt://rsyslog/rsyslog.conf.logserver
  21. {% else %}
  22. - source: salt://rsyslog/rsyslog.conf
  23. {% endif %}
  24. #
  25. # Install filter rules everywhere so we have the same log layout everywhere
  26. # and avoid logging stuff (kernel log, dhcpd, ...) multiple times (daemon.log,
  27. # message, syslog) on every node.
  28. #
  29. /etc/rsyslog.d/ffho.conf:
  30. file.managed:
  31. - source: salt://rsyslog/ffho.conf
  32. - watch_in:
  33. - service: rsyslog
  34. - require:
  35. - file: /etc/rsyslog.d/ffho
  36. /etc/rsyslog.d/ffho:
  37. file.recurse:
  38. - source: salt://rsyslog/ffho
  39. - file_mode: 644
  40. - dir_mode: 755
  41. - user: root
  42. - group: root
  43. - clean: true
  44. - watch_in:
  45. - service: rsyslog
  46. /etc/logrotate.d/ffho:
  47. file.managed:
  48. - source: salt://rsyslog/ffho.logrotate
  49. {% if 'logserver' in roles %}
  50. /etc/rsyslog.d/99-debug.conf:
  51. file.managed:
  52. - source: salt://rsyslog/99-debug.conf
  53. - watch_in:
  54. - service: rsyslog
  55. {% endif %}