init.sls 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. - ca-certificates-java
  23. - require:
  24. - pkgrepo: graylog-repo
  25. - service: mongodb
  26. - service: elasticsearch
  27. service.running:
  28. - enable: True
  29. - require:
  30. - pkg: graylog-server
  31. - file: /etc/graylog/server/server.conf
  32. - watch:
  33. - file: /etc/graylog/server/server.conf
  34. /etc/graylog/server/server.conf:
  35. file.managed:
  36. - source: salt://graylog/server.conf.tmpl
  37. - template: jinja
  38. - context:
  39. graylog_config: {{ graylog_config }}
  40. - require:
  41. - pkg: graylog-server
  42. /etc/default/graylog-server:
  43. file.managed:
  44. - source: salt://graylog/default-graylog-server
  45. - mode: 644
  46. - require:
  47. - pkg: graylog-server
  48. # Default connection config for graylog api scripts
  49. /etc/graylog-api-scripts.conf:
  50. file.managed:
  51. - source: salt://graylog/graylog-api-scripts.conf.tmpl
  52. - mode: 600
  53. - template: jinja
  54. - context:
  55. graylog_config: {{ graylog_config }}
  56. # Install cronjob and notification script
  57. /etc/cron.d/graylog-system-notifications:
  58. file.managed:
  59. - source: salt://graylog/graylog-system-notifications.cron
  60. /usr/local/sbin/graylog-system-notifications:
  61. file.managed:
  62. - source: salt://graylog/graylog-system-notifications
  63. - mode: 700
  64. - template: jinja
  65. - context:
  66. graylog_config: {{ graylog_config }}
  67. # Install cronjob, group mapping script and config files
  68. /etc/graylog-group-mapping.conf:
  69. file.managed:
  70. - source: salt://graylog/graylog-group-mapping.conf.tmpl
  71. - mode: 600
  72. - template: jinja
  73. - context:
  74. graylog_config: {{ graylog_config }}
  75. /etc/cron.d/graylog-group-mapping:
  76. file.managed:
  77. - source: salt://graylog/graylog-group-mapping.cron
  78. /usr/local/sbin/graylog-group-mapping:
  79. file.managed:
  80. - source: salt://graylog/graylog-group-mapping
  81. - mode: 700
  82. - template: jinja
  83. - context:
  84. graylog_config: {{ graylog_config }}