init.sls 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #
  2. # graylog
  3. #
  4. {% set graylog_config = salt['pillar.get']('logging:graylog') %}
  5. include:
  6. - mongodb
  7. - elasticsearch
  8. graylog-repo:
  9. # add Graylog Repo
  10. pkgrepo.managed:
  11. - humanname: Graylog Repo
  12. - name: deb https://packages.graylog2.org/repo/debian/ stable 4.3
  13. - file: /etc/apt/sources.list.d/graylog.list
  14. - key_url: https://packages.graylog2.org/repo/debian/keyring.gpg
  15. # install graylog
  16. graylog-server:
  17. pkg.installed:
  18. - pkgs:
  19. - graylog-server
  20. - python3-ldap
  21. - require:
  22. - pkgrepo: graylog-repo
  23. - service: mongodb
  24. - service: elasticsearch
  25. service.running:
  26. - enable: True
  27. - require:
  28. - pkg: graylog-server
  29. - file: /etc/graylog/server/server.conf
  30. - watch:
  31. - file: /etc/graylog/server/server.conf
  32. /etc/graylog/server/server.conf:
  33. file.managed:
  34. - source: salt://graylog/server.conf.tmpl
  35. - template: jinja
  36. - context:
  37. graylog_config: {{ graylog_config }}
  38. - require:
  39. - pkg: graylog-server
  40. # Default connection config for graylog api scripts
  41. /etc/graylog-api-scripts.conf:
  42. file.managed:
  43. - source: salt://graylog/graylog-api-scripts.conf.tmpl
  44. - mode: 600
  45. - template: jinja
  46. - context:
  47. graylog_config: {{ graylog_config }}
  48. # Install cronjob and notification script
  49. /etc/cron.d/graylog-system-notifications:
  50. file.managed:
  51. - source: salt://graylog/graylog-system-notifications.cron
  52. /usr/local/sbin/graylog-system-notifications:
  53. file.managed:
  54. - source: salt://graylog/graylog-system-notifications
  55. - mode: 700
  56. - template: jinja
  57. - context:
  58. graylog_config: {{ graylog_config }}
  59. # Install cronjob, group mapping script and config files
  60. /etc/graylog-group-mapping.conf:
  61. file.managed:
  62. - source: salt://graylog/graylog-group-mapping.conf.tmpl
  63. - mode: 600
  64. - template: jinja
  65. - context:
  66. graylog_config: {{ graylog_config }}
  67. /etc/cron.d/graylog-group-mapping:
  68. file.managed:
  69. - source: salt://graylog/graylog-group-mapping.cron
  70. /usr/local/sbin/graylog-group-mapping:
  71. file.managed:
  72. - source: salt://graylog/graylog-group-mapping
  73. - mode: 700
  74. - template: jinja
  75. - context:
  76. graylog_config: {{ graylog_config }}