diff --git a/tasks/main.yml b/tasks/main.yml index 55b14eb..46007ea 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -37,7 +37,7 @@ - name: "Copy telegraf extra plugins" template: - src: "telegraf.conf.j2" + src: "telegraf-extra-plugin.conf.j2" dest: "/etc/telegraf/telegraf.d/{{ item.plugin }}.conf" owner: root group: root diff --git a/templates/telegraf-extra-plugin.conf.j2 b/templates/telegraf-extra-plugin.conf.j2 index e69de29..c6f90b0 100644 --- a/templates/telegraf-extra-plugin.conf.j2 +++ b/templates/telegraf-extra-plugin.conf.j2 @@ -0,0 +1,44 @@ + +{% if telegraf_plugins_extra is defined and telegraf_plugins_extra is iterable %} +{% for item in telegraf_plugins_extra %} +[[inputs.{{ item.plugin }}]] +{% if item.interval is defined %} + interval = "{{ item.interval }}s" +{% endif %} +{% if item.config is defined and item.config is iterable %} +{% for items in item.config %} + {{ items }} +{% endfor %} +{% endif %} +{% if item.tagpass is defined and item.tagpass is iterable %} +[{{ item.plugin }}.tagpass] +{% for items in item.tagpass %} + {{ items }} +{% endfor %} +{% endif %} +{% if item.tagdrop is defined and item.tagdrop is iterable %} +[{{ item.plugin }}.tagdrop] +{% for items in item.tagdrop %} + {{ items }} +{% endfor %} +{% endif %} +{% if item.pass is defined and item.pass is iterable %} +[{{ item.plugin }}.pass] +{% for items in item.pass %} + {{ items }} +{% endfor %} +{% endif %} +{% if item.drop is defined and item.drop is iterable %} +[{{ item.plugin }}.drop] +{% for items in item.drop %} + {{ items }} +{% endfor %} +{% endif %} +{% if item.specifications is defined and item.specifications is iterable %} +[[{{item.plugin}}.specifications]] +{% for items in item.specifications %} + {{ items }} +{% endfor %} +{% endif %} +{% endfor %} +{% endif %} \ No newline at end of file