Skip to content

Commit fb48ffd

Browse files
authored
Fix YAML/Jinja2 syntax (#243)
... and other problems that make our checks fail. I try hard to only use configuration in Molecule or quick workarounds. Every issue I find will go into it's own issue in this repository. fixes #242
1 parent fad7ed9 commit fb48ffd

File tree

10 files changed

+36
-46
lines changed

10 files changed

+36
-46
lines changed

.config/ansible-lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ warn_list:
77
- key-order[task] # Ensure specific order of keys in mappings.
88
- name[casing]
99
- 'risky-shell-pipe'
10-
- no-handler # backup of old certificates
1110
- var-naming[no-role-prefix] # remove when https://github.com/ansible/ansible-lint/discussions/3451 is done
1211
skip_list:
1312
- '106'
@@ -16,3 +15,4 @@ skip_list:
1615
- 'line-length'
1716
- 'package-latest'
1817
- yaml # Violations reported by yamllint.
18+
- no-handler # backup of old certificates

docs/logstash-pipelines.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ Every Output can have a `congestion:` option with a numerical value. If the Redi
205205

206206
### Unsafe shutdown ###
207207

208-
If you need unsafe Logstash shutdowns, e.g. for testing, you can set `logstash_pipeline_unsafe_shutdown` to `true`. If you want better controll over which pipeline is allowed to shutdown unsafely, there are `ansible_input_unsafe_shutdown`and `ansible_forwarder_unsafe_shutdown` for default pipelines. And every pipeline has it's own `unsafe_shutdown` setting. All three default to the value of `logstash_pipeline_unsafe_shutdown` which by itself defaults to `false`.
208+
If you need unsafe Logstash shutdowns, e.g. for testing, you can set `logstash_pipeline_unsafe_shutdown` to `true`. The variable doesn't have a default so Logstash falls back to its internal default of `false`.
209209

210210
## Caveats ##
211211

molecule/elasticstack_default/converge.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@
1313
elasticsearch_jna_workaround: true
1414
elasticsearch_disable_systemcallfilterchecks: true
1515
elasticstack_release: "{{ lookup('env', 'ELASTIC_RELEASE') | int}}"
16-
elasticsearch_heap: "1"
16+
elasticsearch_heap: "2"
1717
elasticstack_full_stack: true
1818
logstash_pipeline_unsafe_shutdown: true
19+
logstash_password_hash: false
1920
beats_filebeat_syslog_udp: true
2021
beats_filebeat_syslog_tcp: true
2122
beats_filebeat_modules:
@@ -28,10 +29,13 @@
2829
elasticstack_rpm_workaround: true
2930
when: ansible_os_family == 'RedHat' and ansible_distribution_major_version >= "9"
3031
- name: Update apt cache.
31-
apt: update_cache=yes cache_valid_time=600
32+
ansible.builtin.apt:
33+
update_cache: yes
34+
cache_valid_time: 600
35+
changed_when: false
3236
when: ansible_os_family == 'Debian'
3337
- name: Install dependencies
34-
package:
38+
ansible.builtin.package:
3539
name:
3640
- curl
3741
- name: Include Redis

molecule/elasticstack_default/verify.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@
77
elasticstack_initial_passwords: /usr/share/elasticsearch/initial_passwords
88
tasks:
99

10-
- name: Give some time for tools to connect
11-
ansible.builtin.wait_for:
12-
timeout: 120
13-
1410
- name: Run Logstash syntax check
1511
ansible.builtin.command: "/usr/share/logstash/bin/logstash --path.settings=/etc/logstash -t"
1612
when: "'logstash' in group_names"

roles/elasticsearch/tasks/elasticsearch-security.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
- name: Set the ca expiration date in days
2626
ansible.builtin.set_fact:
27-
elasticstack_ca_expiration_days: "{{ (( elasticstack_ca_infos.not_valid_after | to_datetime()) - (ansible_date_time.date | to_datetime('%Y-%m-%d'))).days }}"
27+
elasticstack_ca_expiration_days: "{{ ((elasticstack_ca_infos.not_valid_after | to_datetime()) - (ansible_date_time.date | to_datetime('%Y-%m-%d'))).days }}"
2828
when: inventory_hostname == elasticstack_ca and elasticstack_ca_infos.skipped is not defined
2929

3030
- name: Set ca will expire soon to true

roles/elasticsearch/tasks/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@
148148
mode: "2750"
149149
when: item.create | bool
150150
loop:
151-
- {create: "{{elasticsearch_create_logpath}}", path: "{{ elasticsearch_logpath }}" }
152-
- {create: "{{elasticsearch_create_datapath}}", path: "{{ elasticsearch_datapath }}" }
151+
- {create: "{{ elasticsearch_create_logpath }}", path: "{{ elasticsearch_logpath }}" }
152+
- {create: "{{ elasticsearch_create_datapath }}", path: "{{ elasticsearch_datapath }}" }
153153

154154
- name: Import Tasks elasticsearch-security.yml
155155
ansible.builtin.import_tasks: elasticsearch-security.yml

roles/elasticsearch/templates/jvm.options.j2

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,15 @@
7373
################################################################
7474

7575
## GC configuration
76-
{% if elasticstack_release is version('7.6.0', '<') %}
77-
-XX:+UseConcMarkSweepGC
78-
-XX:CMSInitiatingOccupancyFraction=75
79-
-XX:+UseCMSInitiatingOccupancyOnly
80-
{% else %}
81-
8-13:-XX:+UseConcMarkSweepGC
82-
8-13:-XX:CMSInitiatingOccupancyFraction=75
83-
8-13:-XX:+UseCMSInitiatingOccupancyOnly
84-
{% endif %}
76+
#{% if elasticstack_release is version('7.6.0', '<') %}
77+
##-XX:+UseConcMarkSweepGC
78+
##-XX:CMSInitiatingOccupancyFraction=75
79+
##-XX:+UseCMSInitiatingOccupancyOnly
80+
#{% else %}
81+
#8-13:-XX:+UseConcMarkSweepGC
82+
#8-13:-XX:CMSInitiatingOccupancyFraction=75
83+
#8-13:-XX:+UseCMSInitiatingOccupancyOnly
84+
#{% endif %}
8585

8686
## G1GC Configuration
8787
# NOTE: G1 GC is only supported on JDK version 10 or later

roles/logstash/defaults/main.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ logstash_config_path_logs: /var/log/logstash
1717
# pipeline configuration #
1818
logstash_manage_pipelines: true
1919
logstash_queue_type: persisted
20-
logstash_pipeline_unsafe_shutdown: false
2120

2221
# this will deactivate all pipeline management
2322
logstash_no_pipelines: false

roles/logstash/templates/logstash.yml.j2

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ http.port: {{ logstash_http_port }}
1313
{% if logstash_global_ecs is defined %}
1414
pipeline.ecs_compatibility: {{ logstash_global_ecs }}
1515
{% endif %}
16+
{% if pipeline.unsafe_shutdown is defined %}
17+
pipeline.unsafe_shutdown: {{ logstash_pipeline_unsafe_shutdown }}
18+
{% endif %}
1619
{% if logstash_legacy_monitoring | bool and elasticstack_full_stack | bool and elasticstack_variant == "elastic" and elasticstack_release | int < 8 %}
1720
xpack.monitoring.enabled: true
1821
xpack.monitoring.elasticsearch.hosts: [ {% for host in logstash_elasticsearch %}"https://{{ host }}:{{ elasticstack_elasticsearch_http_port }}"{% if not loop.last %},{% endif %}{% endfor %} ]

roles/logstash/templates/pipelines.yml.j2

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,29 +19,21 @@
1919
# Default beat input #
2020
# Autoconfigured Redis outputs: input
2121

22-
- pipeline
23-
id: ansible-input
24-
unsafe_shutdown: {{ ansible_input_unsafe_shutdown | default({{ logstash_pipeline_unsafe_shutdown }}) }}
25-
path
26-
config: "/etc/logstash/conf.d/ansible-input/*.conf"
27-
queue
28-
type: {{ logstash_input_queue_type }}
29-
max_bytes: {{ logstash_input_queue_max_bytes }}
22+
- pipeline.id: ansible-input
23+
path.config: "/etc/logstash/conf.d/ansible-input/*.conf"
24+
queue.type: {{ logstash_input_queue_type }}
25+
queue.max_bytes: {{ logstash_input_queue_max_bytes }}
3026

3127
{% endif %}
3228
{% if logstash_elasticsearch_output | bool %}
3329

3430
# Default elasticsearch output #
3531
# Autoconfigured Redis input: forwarder
3632

37-
- pipeline
38-
id: ansible-forwarder
39-
unsafe_shutdown: {{ ansible_forwarder_unsafe_shutdown | default({{ logstash_pipeline_unsafe_shutdown }}) }}
40-
path
41-
config: "/etc/logstash/conf.d/ansible-forwarder/*.conf"
42-
queue
43-
type: {{ logstash_forwarder_queue_type }}
44-
max_bytes: {{ logstash_forwarder_queue_max_bytes }}
33+
- pipeline.id: ansible-forwarder
34+
path.config: "/etc/logstash/conf.d/ansible-forwarder/*.conf"
35+
queue.type: {{ logstash_forwarder_queue_type }}
36+
queue.max_bytes: {{ logstash_forwarder_queue_max_bytes }}
4537

4638
{% endif %}
4739
{% if logstash_pipelines is defined %}
@@ -72,14 +64,10 @@
7264

7365
{% endif %}
7466

75-
- pipeline
76-
id: {{ item.name }}
77-
unsafe_shutdown: {{ item.unsafe_shutdown | default({{ logstash_pipeline_unsafe_shutdown }}) }}
78-
path
79-
config: "/etc/logstash/conf.d/{{ item.name }}/*.conf"
80-
queue
81-
type: {{ item.queue_type | default('memory') }}
82-
max_bytes: {{ item.queue_max_bytes | default('1gb') }}
67+
- pipeline.id: {{ item.name }}
68+
path.config: "/etc/logstash/conf.d/{{ item.name }}/*.conf"
69+
queue.type: {{ item.queue_type | default('memory') }}
70+
queue.max_bytes: {{ item.queue_max_bytes | default('1gb') }}
8371

8472
{% endfor %}
8573
{% endif %}

0 commit comments

Comments
 (0)