From ebacc2cb3bdf5ac2f5f6ed5af734ef3d8ee090eb Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Thu, 18 Feb 2021 12:00:06 +0100 Subject: [PATCH] Update to 2021-02-18 12:00 --- roles/graylog/defaults/main.yml | 4 ++-- roles/graylog/tasks/archive_pre.yml | 11 ++++++++++- roles/graylog/templates/server.conf.j2 | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/roles/graylog/defaults/main.yml b/roles/graylog/defaults/main.yml index 32a0df2..3a12ad0 100644 --- a/roles/graylog/defaults/main.yml +++ b/roles/graylog/defaults/main.yml @@ -1,8 +1,8 @@ --- -graylog_version: 4.0.2 +graylog_version: 4.0.3 graylog_archive_url: https://downloads.graylog.org/releases/graylog/graylog-{{ graylog_version }}.tgz -graylog_archive_sha1: 3c061569549bd5139634e20c8f5e0f922810927b +graylog_archive_sha1: aa0d1107880b647bdd6df88b788145d05c2d725e graylog_root_dir: /opt/graylog graylog_manage_upgrade: True diff --git a/roles/graylog/tasks/archive_pre.yml b/roles/graylog/tasks/archive_pre.yml index d2d74f1..65634e1 100644 --- a/roles/graylog/tasks/archive_pre.yml +++ b/roles/graylog/tasks/archive_pre.yml @@ -14,5 +14,14 @@ tags: graylog - name: Archive mongo database - command: mongodump --quiet --out {{ graylog_root_dir }}/archives/{{ graylog_current_version }}/mongo --uri {{ graylog_mongo_url[0] }} + shell: | + mongodump --quiet \ + --out {{ graylog_root_dir }}/archives/{{ graylog_current_version }}/mongo \ + --uri \ + {% if graylog_mongo_pass is defined and graylog_mongo_pass != False and graylog_mongo_url | length == 1 %} + {% set url = graylog_mongo_url[0] %} + {{ url | urlsplit('scheme') }}://{{ graylog_mongo_user }}:{{ graylog_mongo_pass | urlencode | regex_replace('/','%2F') }}@{{ url | urlsplit('hostname') }}{% if url | urlsplit('port') %}:{{ url | urlsplit('port') }}{% endif %}{{ url | urlsplit('path') }}?{{ url | urlsplit('query') }} + {% else %} + {{ graylog_mongo_url[0] }} + {% endif %} tags: graylog diff --git a/roles/graylog/templates/server.conf.j2 b/roles/graylog/templates/server.conf.j2 index 291493e..1afdbdb 100644 --- a/roles/graylog/templates/server.conf.j2 +++ b/roles/graylog/templates/server.conf.j2 @@ -17,7 +17,7 @@ trusted_proxies = {% for host in graylog_http_src_ip %}{{ host }}{% if not host elasticsearch_hosts = {{ graylog_es_hosts | join(',') }} elasticsearch_cluster_name = {{ graylog_es_cluster_name | default('elasticsearch') }} {% if graylog_mongo_pass is defined and graylog_mongo_pass != False and graylog_mongo_url | length == 1 %} -mongodb_uri = {% for url in graylog_mongo_url %}{{ url | urlsplit('scheme') }}://{{ graylog_mongo_user }}:{{ graylog_mongo_pass | urlencode | regex_replace('/','%2F') }}@{{ url | urlsplit('hostname') }}{% if url | urlsplit('port') %}:{{ url | urlsplit('port') }}{% endif %}{{ url | urlsplit('path') }}{{ url | urlsplit('query') }}{% if not loop.last %},{% endif %} +mongodb_uri = {% for url in graylog_mongo_url %}{{ url | urlsplit('scheme') }}://{{ graylog_mongo_user }}:{{ graylog_mongo_pass | urlencode | regex_replace('/','%2F') }}@{{ url | urlsplit('hostname') }}{% if url | urlsplit('port') %}:{{ url | urlsplit('port') }}{% endif %}{{ url | urlsplit('path') }}?{{ url | urlsplit('query') }}{% if not loop.last %},{% endif %} {% endfor %} {% else %} mongodb_uri = {{ graylog_mongo_url | join(',') }}