Add possibility to define plugins in meta
Change-Id: I7035f1a5f3affc2a02732fb17e7cf56d8f718a66
diff --git a/fluentd/agent.sls b/fluentd/agent.sls
index 463247f..d1ed8d8 100644
--- a/fluentd/agent.sls
+++ b/fluentd/agent.sls
@@ -5,12 +5,22 @@
pkg.installed:
- names: {{ fluentd_agent.pkgs }}
-fluentd_gems_agent:
+{%- for plugin_name, plugin in fluentd_agent.plugin.iteritems() %}
+ {%- if plugin.get('deb') %}
+fluentd_packages_agent_{{ plugin_name }}:
+ pkg.installed:
+ - names: {{ plugin.get('deb') }}
+ - require:
+ - pkg: fluentd_packages_agent
+ {%- elif plugin.get('gem') %}
+fluentd_gems_agent_{{ plugin_name }}:
gem.installed:
- - names: {{ fluentd_agent.gems }}
+ - names: {{ plugin.get('gem') }}
- gem_bin: {{ fluentd_agent.gem_path }}
- require:
- pkg: fluentd_packages_agent
+ {%- endif %}
+{%- endfor %}
fluentd_config_d_dir:
file.directory:
diff --git a/fluentd/map.jinja b/fluentd/map.jinja
index 95bcd72..f9cc8d1 100644
--- a/fluentd/map.jinja
+++ b/fluentd/map.jinja
@@ -3,7 +3,11 @@
'user': 'root',
'group': 'root',
'pkgs': ['td-agent', 'build-essential', 'ruby-dev'],
- 'gems': ['fluent-plugin-prometheus', 'fluent-plugin-grok-parser', 'fluent-plugin-systemd', 'fluent-plugin-elasticsearch'],
+ 'plugin': {
+ 'fluent-plugin-elasticsearch': {
+ 'gem': ['fluent-plugin-elasticsearch']
+ },
+ },
'gem_path': 'td-agent-gem',
'service_name': 'td-agent',
'dir': {
diff --git a/tests/pillar/agent.sls b/tests/pillar/agent.sls
index a5afd84..e2ba794 100644
--- a/tests/pillar/agent.sls
+++ b/tests/pillar/agent.sls
@@ -1,6 +1,9 @@
fluentd:
agent:
enabled: true
+ plugin:
+ fluent-plugin-elasticsearch:
+ gem: ['fluent-plugin-elasticsearch']
config:
label:
monitoring: