Skip to content

Commit 93e37cf

Browse files
Feat/graylog assert (#197)
* feat(roles/graylog_datanode): add validation for graylog_datanode__password_secret length * feat(roles/graylog_server): add validation for graylog_server__password_secret length * feat(roles/graylog_datanode): allow users to specify path_node variable in datanode.conf * fix assert logic * update docs, add setting for graylog_datanode__node_search_cache_size * add validation and readme entry for graylog_datanode__node_search_cache_size * remove invalid assert * fix(roles/graylog_server): update server configuration to disable telemetry * fix(roles/graylog_datanode): restrict permissions for snapshot repo paths * fix(roles/graylog_datanode): extend datanode configuration options to allow __raw configs * incorporate feedback from pull request * fix whitespace, headers in templates * update changelog * style(roles/graylog_*): fix whitespace --------- Co-authored-by: Navid Sassan <navid.sassan@linuxfabrik.ch>
1 parent 02b1f77 commit 93e37cf

13 files changed

Lines changed: 145 additions & 9 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1616

1717
### Added
1818

19+
* **role:graylog_datanode**: Add optional variable `graylog_datanode__raw`.
20+
* **role:graylog_datanode**: Add optional variables `graylog_datanode__path_repos`, `graylog_datanode__node_search_cache_size` to configure searchable snapshot locations and size of disk-based searchable snapshot cache.
1921
* **role:infomaniak_vm**: Add `keep_port_on_absent` subkey on `infomaniak_vm__networks` entries to preserve the port (and its fixed IP) when the VM is set to `infomaniak_vm__state: 'absent'`, so the same IP can be re-used
2022
* **role:infomaniak_vm**: Add `port_name` subkey on `infomaniak_vm__networks` entries to override the name of the managed port. Defaults to the previous `{{ infomaniak_vm__name }}--{{ item["name"] }}--port` pattern, so existing setups are unaffected
2123
* **role:kibana**: Add `kibana__logging` variable to make the `logging:` block in `kibana.yml` fully user-configurable (appenders, loggers, root, rotation). The default preserves the previous hardcoded behavior: JSON logs at `/var/log/kibana/kibana.log`, rotated daily, 14 rotations kept
2224
* **ci**: Add bandit (security) and vulture (dead code) to pre-commit hooks
2325

2426
### Fixed
2527

28+
* **role:graylog_datanode**: Validate that `graylog_datanode__password_secret | length >= 16`
29+
* **role:graylog_server**: Validate that `graylog_server__password_secret | length >= 16`
2630
* **role:nextcloud**: Ensure that the Nextcloud OCC is executable.
2731
* **execution-environment**: Add missing `sshpass` system package, required for SSH password-based connections (e.g. `--ask-pass`)
2832
* **role:keycloak**: Fix transaction timeout silently dropping from 3600s to 300s on Keycloak 26.6.0+ due to new `transaction-default-timeout` CLI option overriding the Quarkus property
@@ -31,6 +35,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3135

3236
### Changed
3337

38+
* **role:graylog_server**: Update `server.conf` templates to include `telemetry_enabled = false`.
3439
* **role:keepalived**: Document role scope in the README. The role intentionally covers only a minimal VRRP setup (single `vrrp_instance`, single `virtual_ipaddress`, PASS auth, `smtp_alert`). It does not set the `net.ipv4.ip_nonlocal_bind` sysctl and does not open the firewall for VRRP; pointers to the `kernel_settings` and `firewall` roles are included
3540
* **all roles**: Rewrite all role READMEs to use the new standard format: replace markdown tables with bullet lists for tags and variables, convert HTML/blockquote subkeys to expanded indented format, standardize terminology (`Bool` not `Boolean`, `Mandatory` not `Required`)
3641
* **role:opensearch**: Rewrite README with step-by-step cluster setup guide, single-node section, post-installation steps, and improved variable documentation

roles/graylog_datanode/README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@ graylog_datanode__password_secret: 'Linuxfabrik_GmbH'
7878
* Type: String.
7979
* Default: `'mongodb://127.0.0.1/graylog'`
8080

81+
`graylog_datanode__node_search_cache_size`
82+
83+
* Size of disk-based cache for searchable snaphots. This space will be automatically reserved if `graylog_datanode__path_repos` is configured. See [docs.opensearch.org - Supported Units](https://docs.opensearch.org/latest/api-reference/units/) for a list of possible options. This setting is only applied when `graylog_datanode__path_repos` contains at least one path.
84+
* Type: String.
85+
* Default: `10gb`
86+
8187
`graylog_datanode__opensearch_data_location`
8288

8389
* Set this OpenSearch folder if you need OpenSearch to be located in a special place.
@@ -90,6 +96,18 @@ graylog_datanode__password_secret: 'Linuxfabrik_GmbH'
9096
* Type: String.
9197
* Default: 50% of system memory, e.g. `'8g'`
9298

99+
`graylog_datanode__path_repos`
100+
101+
* Filesystem paths where searchable snapshots should be stored.
102+
* Type: List of Strings.
103+
* Default: `[]`
104+
105+
`graylog_datanode__raw`
106+
107+
* Multiline string. Raw content which will be appended to the `datanode.conf` config file. Note that the config file uses the Java properties format and not YAML.
108+
* Type: String.
109+
* Default: unset
110+
93111
`graylog_datanode__service_enabled`
94112

95113
* Enables or disables the graylog-datanode service, analogous to `systemctl enable/disable --now`.
@@ -102,8 +120,13 @@ Example:
102120
graylog_datanode__bind_address: '127.0.0.1'
103121
graylog_datanode__datanode_http_port: 8999
104122
graylog_datanode__mongodb_uri: 'mongodb://127.0.0.1/graylog'
123+
graylog_datanode__node_search_cache_size: '5gb'
105124
graylog_datanode__opensearch_data_location: '/data/opensearch'
106125
graylog_datanode__opensearch_heap: '8g'
126+
graylog_datanode__path_repos:
127+
- '/mnt/backups/graylog-datanode/backup'
128+
graylog_datanode__raw: |-
129+
insecure_startup = false
107130
graylog_datanode__service_enabled: true
108131
```
109132

roles/graylog_datanode/defaults/main.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
graylog_datanode__bind_address: '127.0.0.1'
22
graylog_datanode__datanode_http_port: 8999
3+
graylog_datanode__mongodb_uri: 'mongodb://127.0.0.1/graylog'
4+
graylog_datanode__node_search_cache_size: '10gb'
35
graylog_datanode__opensearch_data_location: '/var/lib/graylog-datanode/opensearch/data'
46
graylog_datanode__opensearch_heap: '{{ [((ansible_facts["memtotal_mb"] * 0.5) | int), 31744] | min }}m'
5-
graylog_datanode__mongodb_uri: 'mongodb://127.0.0.1/graylog'
7+
graylog_datanode__path_repos: []
68
graylog_datanode__service_enabled: true
79

810
# ------

roles/graylog_datanode/tasks/main.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
- block:
2+
3+
- name: 'Validate that graylog_datanode__password_secret length >= 16 characters'
4+
ansible.builtin.assert:
5+
that:
6+
- 'graylog_datanode__password_secret | length >= 16'
7+
fail_msg: 'graylog_datanode__password_secret must be at least 16 characters'
8+
quiet: true
9+
10+
- name: 'Validate that graylog_datanode__node_search_cache_size follows OpenSearch Bytes format'
11+
ansible.builtin.assert:
12+
that:
13+
- 'graylog_datanode__node_search_cache_size | ansible.builtin.regex_search("^[0-9]+(b|kb|mb|gb|tb|pb)$")'
14+
fail_msg: '`graylog_datanode__node_search_cache_size: {{ graylog_datanode__node_search_cache_size }}` does not follow OpenSearch Bytes format'
15+
quiet: true
16+
17+
tags:
18+
- 'always'
19+
20+
121
- block:
222

323
- name: 'Install graylog-datanode'
@@ -62,6 +82,15 @@
6282
group: 'graylog-datanode'
6383
mode: 0o755
6484

85+
- name: 'mkdir -p {{ item }}; chown graylog-datanode:graylog-datanode {{ item }}'
86+
ansible.builtin.file:
87+
path: '{{ item }}'
88+
state: 'directory'
89+
owner: 'graylog-datanode'
90+
group: 'graylog-datanode'
91+
mode: 0o740
92+
loop: '{{ graylog_datanode__path_repos }}'
93+
6594
tags:
6695
- 'graylog_datanode'
6796
- 'graylog_datanode:configure'

roles/graylog_datanode/templates/etc/graylog/datanode/6.1-datanode.conf.j2

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# {{ ansible_managed }}
2-
# 2025082001
2+
# 2026042401
33
# 6.1
44
# see https://go2docs.graylog.org/6-1/setting_up_graylog/data_node_configuration_file.htm
55
#####################################
@@ -163,3 +163,13 @@ opensearch_logs_location = /var/log/graylog-datanode/opensearch
163163
# indexer_jwt_auth_token_expiration_duration = 180s
164164

165165
opensearch_heap = {{ graylog_datanode__opensearch_heap }}
166+
167+
{% if graylog_datanode__path_repos | length %}
168+
#### Data Tiering Properties
169+
node_search_cache_size = {{ graylog_datanode__node_search_cache_size }}
170+
path_repo = {{ graylog_datanode__path_repos | join(',') }}
171+
{% endif %}
172+
{% if graylog_datanode__raw is defined and graylog_datanode__raw | length %}
173+
#### Raw
174+
{{ graylog_datanode__raw }}
175+
{% endif %}

roles/graylog_datanode/templates/etc/graylog/datanode/6.2-datanode.conf.j2

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# {{ ansible_managed }}
2-
# 2025082001
2+
# 2026042401
33
# 6.2
44
# see https://go2docs.graylog.org/6-2/setting_up_graylog/data_node_configuration_file.htm
55
#####################################
@@ -163,3 +163,13 @@ opensearch_logs_location = /var/log/graylog-datanode/opensearch
163163
# indexer_jwt_auth_token_expiration_duration = 180s
164164

165165
opensearch_heap = {{ graylog_datanode__opensearch_heap }}
166+
167+
{% if graylog_datanode__path_repos | length %}
168+
#### Data Tiering Properties
169+
node_search_cache_size = {{ graylog_datanode__node_search_cache_size }}
170+
path_repo = {{ graylog_datanode__path_repos | join(',') }}
171+
{% endif %}
172+
{% if graylog_datanode__raw is defined and graylog_datanode__raw | length %}
173+
#### Raw
174+
{{ graylog_datanode__raw }}
175+
{% endif %}

roles/graylog_datanode/templates/etc/graylog/datanode/6.3-datanode.conf.j2

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# {{ ansible_managed }}
2-
# 2025082001
2+
# 2026042401
33
# 6.3
44
# see https://go2docs.graylog.org/6-3/setting_up_graylog/data_node_configuration_file.htm
55
#####################################
@@ -163,3 +163,13 @@ opensearch_logs_location = /var/log/graylog-datanode/opensearch
163163
# indexer_jwt_auth_token_expiration_duration = 180s
164164

165165
opensearch_heap = {{ graylog_datanode__opensearch_heap }}
166+
167+
{% if graylog_datanode__path_repos | length %}
168+
#### Data Tiering Properties
169+
node_search_cache_size = {{ graylog_datanode__node_search_cache_size }}
170+
path_repo = {{ graylog_datanode__path_repos | join(',') }}
171+
{% endif %}
172+
{% if graylog_datanode__raw is defined and graylog_datanode__raw | length %}
173+
#### Raw
174+
{{ graylog_datanode__raw }}
175+
{% endif %}

roles/graylog_datanode/templates/etc/graylog/datanode/7.0-datanode.conf.j2

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# {{ ansible_managed }}
2-
# 2026011601
2+
# 2026042401
33
# 7.0
44
# see https://go2docs.graylog.org/7-0/setting_up_graylog/data_node_configuration_file.htm
55
#####################################
@@ -163,3 +163,13 @@ opensearch_logs_location = /var/log/graylog-datanode/opensearch
163163
# indexer_jwt_auth_token_expiration_duration = 180s
164164

165165
opensearch_heap = {{ graylog_datanode__opensearch_heap }}
166+
167+
{% if graylog_datanode__path_repos | length %}
168+
#### Data Tiering Properties
169+
node_search_cache_size = {{ graylog_datanode__node_search_cache_size }}
170+
path_repo = {{ graylog_datanode__path_repos | join(',') }}
171+
{% endif %}
172+
{% if graylog_datanode__raw is defined and graylog_datanode__raw | length %}
173+
#### Raw
174+
{{ graylog_datanode__raw }}
175+
{% endif %}

roles/graylog_server/tasks/main.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
- block:
2+
3+
- name: 'Validate that graylog_server__password_secret length >= 16 characters'
4+
ansible.builtin.assert:
5+
that:
6+
- 'graylog_server__password_secret | length >= 16'
7+
fail_msg: 'graylog_server__password_secret must be at least 16 characters'
8+
quiet: true
9+
10+
tags:
11+
- 'always'
12+
13+
114
- block:
215

316
- name: 'Install graylog-server'

roles/graylog_server/templates/etc/graylog/server/6.1-server.conf.j2

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# {{ ansible_managed }}
2-
# 2026012102
2+
# 2026032701
33
# 6.1
44
############################
55
# GRAYLOG CONFIGURATION FILE
@@ -781,3 +781,9 @@ integrations_scripts_dir = /usr/share/graylog-server/scripts
781781
# event-processor-execution-v1
782782
# notification-execution-v1
783783
#job_scheduler_concurrency_limits = event-processor-execution-v1:2,notification-execution-v1:2
784+
785+
##################
786+
# Privacy settings
787+
##################
788+
789+
telemetry_enabled = false

0 commit comments

Comments
 (0)