Skip to content
Snippets Groups Projects
Commit 245470e5 authored by Alexander Käb's avatar Alexander Käb
Browse files

other: update sidecar version and remove filebeat tasks

Update to sidecar version 1.5.0 and remove the filebeat tasks, as
it is now bundled with sidecar. Also make the sidecar version a
variable.
parent 217d6e6e
No related branches found
No related tags found
1 merge request!2other: update sidecar version and remove filebeat tasks
.vscode
...@@ -10,16 +10,8 @@ graylog_sidecar_node_id: 'file:/etc/machine-id' ...@@ -10,16 +10,8 @@ graylog_sidecar_node_id: 'file:/etc/machine-id'
# Sidecar repository urls based on OS family # Sidecar repository urls based on OS family
sidecar_repo_urls: sidecar_repo_urls:
"RedHat": "https://packages.graylog2.org/repo/packages/graylog-sidecar-repository-1-5.noarch.rpm" "RedHat": "https://github.com/Graylog2/collector-sidecar/releases/download/{{ sidecar_version }}/graylog-sidecar-{{ sidecar_version }}-1.x86_64.rpm"
"Debian": "https://packages.graylog2.org/repo/packages/graylog-sidecar-repository_1-5_all.deb" "Debian": "https://github.com/Graylog2/collector-sidecar/releases/download/{{ sidecar_version }}/graylog-sidecar_{{ sidecar_version }}-1_amd64.deb"
# Whether to install filebeat (default: true)
install_filebeat: true
# Filebeat repository urls based on OS family
filebeat_repo_urls:
"RedHat": "https://artifacts.elastic.co/packages/oss-8.x/yum"
"Debian": "https://artifacts.elastic.co/packages/oss-8.x/apt"
``` ```
**Variables required by the user** **Variables required by the user**
......
graylog_sidecar_node_id: 'file:/etc/machine-id' graylog_sidecar_node_id: 'file:/etc/machine-id'
sidecar_version: '1.5.0'
sidecar_repo_urls: sidecar_repo_urls:
"RedHat": "https://github.com/Graylog2/collector-sidecar/releases/download/1.4.0/graylog-sidecar-1.4.0-1.x86_64.rpm" "RedHat": "https://github.com/Graylog2/collector-sidecar/releases/download/{{ sidecar_version }}/graylog-sidecar-{{ sidecar_version }}-1.x86_64.rpm"
"Debian": "https://github.com/Graylog2/collector-sidecar/releases/download/1.4.0/graylog-sidecar_1.4.0-1_amd64.deb" "Debian": "https://github.com/Graylog2/collector-sidecar/releases/download/{{ sidecar_version }}/graylog-sidecar_{{ sidecar_version }}-1_amd64.deb"
sidecar_checksum: https://github.com/Graylog2/collector-sidecar/releases/download/1.4.0/CHECKSUMS-SHA256.txt sidecar_checksum: "https://github.com/Graylog2/collector-sidecar/releases/download/{{ sidecar_version }}/CHECKSUMS-SHA256.txt"
install_filebeat: true
filebeat_repo_urls:
"RedHat": "https://artifacts.elastic.co/packages/oss-8.x/yum"
"Debian": "https://artifacts.elastic.co/packages/oss-8.x/apt"
# --- OTHER --- # --- OTHER ---
use_central_ca_host: false use_central_ca_host: false
......
---
- name: Add filebeat repository (Debian | Ubuntu)
become: true
when: ansible_os_family == 'Debian'
block:
- name: Ensure Apt Can Use Https
ansible.builtin.apt:
name: apt-transport-https
state: present
- name: Ensure ES Signing Key Is Present
ansible.builtin.apt_key:
url: 'https://artifacts.elastic.co/GPG-KEY-elasticsearch'
id: '46095ACC8548582C1A2699A9D27D666CD88E42B4'
state: present^
- name: Ensure ES Repo Is Enabled
ansible.builtin.apt_repository:
repo: "deb {{ filebeat_repo_urls['Debian'] }} stable main"
state: present
- name: Add filebeat repository (RedHat)
ansible.builtin.yum_repository:
name: elastic-8.x
description: Elastic Yum Repo 8.x
baseurl: "{{ filebeat_repo_urls['RedHat'] }}"
gpgcheck: true
gpgkey: 'https://artifacts.elastic.co/GPG-KEY-elasticsearch'
state: present
when: ansible_os_family == 'RedHat'
become: true
- name: Install filebeat package
ansible.builtin.package:
name: filebeat
state: present
become: true
...@@ -35,13 +35,6 @@ ...@@ -35,13 +35,6 @@
(inventory_hostname not in groups['sidecar-ca']) and (inventory_hostname not in groups['sidecar-ca']) and
(inventory_hostname not in groups['graylog-nodes']) (inventory_hostname not in groups['graylog-nodes'])
- name: Include filebeat tasks
ansible.builtin.include_tasks: filebeat.yml
when: >
install_filebeat and
(inventory_hostname not in groups['sidecar-ca']) and
(inventory_hostname not in groups['graylog-nodes'])
- name: Include tasks when using single ca-host - name: Include tasks when using single ca-host
when: use_central_ca_host when: use_central_ca_host
block: block:
...@@ -55,14 +48,6 @@ ...@@ -55,14 +48,6 @@
(inventory_hostname not in groups['graylog-nodes']) and (inventory_hostname not in groups['graylog-nodes']) and
(inventory_hostname not in groups['ca-store']) (inventory_hostname not in groups['ca-store'])
- name: Include filebeat tasks (when using a single ca store and gl-groups defined)
ansible.builtin.include_tasks: filebeat.yml
when: >
install_filebeat and
(inventory_hostname not in groups['sidecar-ca']) and
(inventory_hostname not in groups['graylog-nodes']) and
(inventory_hostname not in groups['ca-store'])
- name: Include sidecar tasks (when using a single ca store without gl-groups defined) - name: Include sidecar tasks (when using a single ca store without gl-groups defined)
when: not (('sidecar-ca' in groups) and ('graylog-nodes' in groups)) when: not (('sidecar-ca' in groups) and ('graylog-nodes' in groups))
block: block:
...@@ -70,10 +55,6 @@ ...@@ -70,10 +55,6 @@
ansible.builtin.include_tasks: sidecar.yml ansible.builtin.include_tasks: sidecar.yml
when: (inventory_hostname not in groups['ca-store']) when: (inventory_hostname not in groups['ca-store'])
- name: Include filebeat tasks (when using a single ca store without gl-groups defined)
ansible.builtin.include_tasks: filebeat.yml
when: (inventory_hostname not in groups['ca-store'])
- name: Switch back to default policy - name: Switch back to default policy
ansible.builtin.command: ansible.builtin.command:
cmd: update-crypto-policies --set DEFAULT cmd: update-crypto-policies --set DEFAULT
......
- name: Create download TMP directory
ansible.builtin.tempfile:
state: directory
prefix: 'sidecar.'
delegate_to: localhost
register: sidecar_tmp_dir
- name: Add sidecar repo (Debian | Ubuntu) - name: Add sidecar repo (Debian | Ubuntu)
when: ansible_os_family == 'Debian' when: ansible_os_family == 'Debian'
become: true become: true
...@@ -6,14 +13,14 @@ ...@@ -6,14 +13,14 @@
ansible.builtin.get_url: ansible.builtin.get_url:
url: "{{ sidecar_repo_urls['Debian'] }}" url: "{{ sidecar_repo_urls['Debian'] }}"
checksum: "sha256:{{ sidecar_checksum }}" checksum: "sha256:{{ sidecar_checksum }}"
dest: /tmp/graylog-sidecar.deb dest: "{{ sidecar_tmp_dir.path }}/graylog-sidecar.deb"
mode: 0644 mode: 0644
delegate_to: localhost delegate_to: localhost
run_once: true run_once: true
- name: Copy DEB to nodes (Debian | Ubuntu) - name: Copy DEB to nodes (Debian | Ubuntu)
ansible.builtin.copy: ansible.builtin.copy:
src: /tmp/graylog-sidecar.deb src: "{{ sidecar_tmp_dir.path }}/graylog-sidecar.deb"
dest: /tmp/graylog-sidecar.deb dest: /tmp/graylog-sidecar.deb
mode: 0644 mode: 0644
...@@ -30,14 +37,14 @@ ...@@ -30,14 +37,14 @@
ansible.builtin.get_url: ansible.builtin.get_url:
url: "{{ sidecar_repo_urls['RedHat'] }}" url: "{{ sidecar_repo_urls['RedHat'] }}"
checksum: "sha256:{{ sidecar_checksum }}" checksum: "sha256:{{ sidecar_checksum }}"
dest: /tmp/graylog-sidecar.rpm dest: "{{ sidecar_tmp_dir.path }}/graylog-sidecar.rpm"
mode: 0644 mode: 0644
delegate_to: localhost delegate_to: localhost
run_once: true run_once: true
- name: Copy RPM to nodes (RedHat) - name: Copy RPM to nodes (RedHat)
ansible.builtin.copy: ansible.builtin.copy:
src: /tmp/graylog-sidecar.rpm src: "{{ sidecar_tmp_dir.path }}/graylog-sidecar.rpm"
dest: /tmp/graylog-sidecar.rpm dest: /tmp/graylog-sidecar.rpm
mode: 0644 mode: 0644
...@@ -47,12 +54,12 @@ ...@@ -47,12 +54,12 @@
state: present state: present
disable_gpg_check: true # Github rpm is not signed, may replace true with actual check if signed or not disable_gpg_check: true # Github rpm is not signed, may replace true with actual check if signed or not
- name: Run install command - name: Cleanup TMP directory
ansible.builtin.command: ansible.builtin.file:
cmd: /usr/bin/graylog-sidecar -service install path: "{{ sidecar_tmp_dir.path }}"
ignore_errors: true state: absent
changed_when: false delegate_to: localhost
become: true when: sidecar_tmp_dir.path is defined
- name: Generate sidecar config - name: Generate sidecar config
ansible.builtin.template: ansible.builtin.template:
...@@ -63,6 +70,13 @@ ...@@ -63,6 +70,13 @@
notify: Restart Sidecar notify: Restart Sidecar
become: true become: true
- name: Run install command
ansible.builtin.command:
cmd: /usr/bin/graylog-sidecar -service install
ignore_errors: true
changed_when: false
become: true
- name: Enable / start sidecar service - name: Enable / start sidecar service
ansible.builtin.service: ansible.builtin.service:
name: graylog-sidecar name: graylog-sidecar
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment