diff --git a/README.md b/README.md index ab0e77894281ab951f4d0d7beaa2965d724db419..9484e0ae36f93283ea379c0b9d23606c8a7aaec9 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,12 @@ graylog_sidecar_server_url: graylog_sidecar_server_api_token: ``` +## Auto fetch configs + +You can specify a list of tags that will be used to auto fetch configs from the graylog +server. To do so add the `config_tags` variable and provide a list of tags for which the +configs should be pulled by the sidecar. + ## Node Certificates For node certificates to be generated you will need to create an additional host group @@ -38,7 +44,7 @@ via a host group called `graylog-nodes`. You may also use a completely separate host to store the CA files for Graylog and the Sidecar service. If this is the case, you need to set the `use_central_ca_host` variable to `true` and provide a host group called `ca-store`. The other groups mentioned earlier -may be omitted. +**need to be omitted**. The log node CA file must be available at: `/etc/graylog/graylog-ca.pem` The sidecar CA file must be available at: `/etc/graylog/sidecar/sidecar-ca.pem` diff --git a/tasks/sidecar.yml b/tasks/sidecar.yml index a5be537f964dbe7996db902204879b5d6d40c309..14d5c4633d2997f2089aa760b04a18d016813680 100644 --- a/tasks/sidecar.yml +++ b/tasks/sidecar.yml @@ -79,6 +79,29 @@ changed_when: false become: true +- name: Create Workaround Symlink for filebeat when version >= '1.5.0' + when: sidecar_version is version('1.5.0', 'ge') + become: true + block: + - name: Create Workaround Symlink | Ensure directories exist + ansible.builtin.file: + path: '/usr/share/filebeat/bin/' + state: directory + mode: '0755' + + - name: Create Workaround Symlink | Check if old filebeat version exists + ansible.builtin.stat: + path: '/usr/share/filebeat/bin/filebeat' + register: filebeat_bin + + - name: Create Workaround Symlink | Create Symlink if required + when: not filebeat_bin.stat.exists + ansible.builtin.file: + src: '/usr/lib/graylog-sidecar/filebeat' + dest: '/usr/share/filebeat/bin/filebeat' + state: link + + - name: Enable / start sidecar service ansible.builtin.service: name: graylog-sidecar diff --git a/templates/sidecar.yml.j2 b/templates/sidecar.yml.j2 index f55db498091db756f5ea264a098d939368420da2..dd5db8a99d4961f24a81a194f41eeabae9cad286 100644 --- a/templates/sidecar.yml.j2 +++ b/templates/sidecar.yml.j2 @@ -3,3 +3,10 @@ server_url: {{ graylog_sidecar_server_url }} server_api_token: {{ graylog_sidecar_server_api_token }} node_id: {{ graylog_sidecar_node_id }} + +{% if config_tags is not none and config_tags | length > 0 %} +tags: +{% for tag in config_tags %} + - {{ tag }} +{% endfor %} +{% endif %} \ No newline at end of file