fix: change logstash_inputs variable: dict to array

This commit is contained in:
Adrien Waksberg 2019-09-30 15:30:12 +02:00
parent f8426465ed
commit 237e9f7a20
4 changed files with 11 additions and 19 deletions

View file

@ -5,6 +5,10 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/)
## [Unreleased] ## [Unreleased]
### Changed
- change logstash_inputs variable: dict to array
## v1.0.0 - 2019-09-29 ## v1.0.0 - 2019-09-29
### Added ### Added

View file

@ -6,6 +6,6 @@ logstash_default_config:
path.data: /var/lib/logstash path.data: /var/lib/logstash
path.logs: /var/log/logstash path.logs: /var/log/logstash
logstash_full_config: '{{ logstash_default_config|combine(logstash_config, recursive=True) }}' logstash_full_config: '{{ logstash_default_config|combine(logstash_config, recursive=True) }}'
logstash_inputs: {} logstash_inputs: []
logstash_outputs: [] logstash_outputs: []
logstash_filters: [] logstash_filters: []

View file

@ -1,21 +1,7 @@
# {{ ansible_managed }} # {{ ansible_managed }}
input { input {
{% for name, options in logstash_inputs.iteritems() %} {% for input in logstash_inputs %}
{{ name }} { {{ input }}
{% for option, value in options.iteritems() %}
{% if value is string %}
{{ option }} => "{{ value }}"
{% elif value is number %}
{{ option }} => {{ value }}
{% elif value is sameas True %}
{{ option }} => true
{% elif value is sameas False %}
{{ option }} => false
{% elif value is iterable %}
{{ option }} => ["{{ value|join('", ') }}"]
{% endif %}
{% endfor %}
}
{% endfor %} {% endfor %}
} }

View file

@ -5,8 +5,10 @@
logstash_plugins: logstash_plugins:
- name: logstash-output-influxdb - name: logstash-output-influxdb
logstash_inputs: logstash_inputs:
file: - >
path: /var/log/syslog file {
path => "/var/log/syslog"
}
logstash_outputs: logstash_outputs:
- > - >
file { file {