init.sls 2.2 KB

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