Skip to content

Commit efc41c7

Browse files
author
Branden Timm
committed
Added checks for presence of pillar data for a plugin type (inputs,filters,outputs), and if it doesn't exist we don't write a config file for it. Also remove any existing config file for that plugin type if there is no pillar data
1 parent 2a62090 commit efc41c7

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

logstash/init.sls

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ logstash-svc:
1717
- require:
1818
- pkg: logstash-pkg
1919
20+
{%- if logstash.inputs is defined %}
2021
logstash-config-inputs:
2122
file.managed:
2223
- name: /etc/logstash/conf.d/01-inputs.conf
@@ -29,7 +30,13 @@ logstash-config-inputs:
2930
- service: logstash-svc
3031
- require:
3132
- pkg: logstash-pkg
33+
{%- else %}
34+
logstash-config-inputs:
35+
file.absent:
36+
- name: /etc/logstash/conf.d/01-inputs.conf
37+
{%- endif %}
3238
39+
{%- if logstash.filters is defined %}
3340
logstash-config-filters:
3441
file.managed:
3542
- name: /etc/logstash/conf.d/02-filters.conf
@@ -42,7 +49,13 @@ logstash-config-filters:
4249
- service: logstash-svc
4350
- require:
4451
- pkg: logstash-pkg
52+
{%- else %}
53+
logstash-config-filters:
54+
file.absent:
55+
- name: /etc/logstash/conf.d/02-filters.conf
56+
{%- endif %}
4557
58+
{%- if logstash.outputs is defined %}
4659
logstash-config-outputs:
4760
file.managed:
4861
- name: /etc/logstash/conf.d/03-outputs.conf
@@ -54,4 +67,9 @@ logstash-config-outputs:
5467
- watch_in:
5568
- service: logstash-svc
5669
- require:
57-
- pkg: logstash-pkg
70+
- pkg: logstash-pkg
71+
{%- else %}
72+
logstash-config-outputs:
73+
file.absent:
74+
- name: /etc/logstash/conf.d/03-outputs.conf
75+
{%- endif %}

0 commit comments

Comments
 (0)