dj-wasabi / ansible-telegraf

Installing and configuring Telegraf via Ansible for RedHat/Debian/Ubuntu/Windows/Suse.
MIT License
134 stars 116 forks source link

multiple plugins in telegraf_plugins_extra are duplicated #22

Closed haraldkoch closed 7 years ago

haraldkoch commented 7 years ago

When I define multiple plugins in telegraf_plugins_extra, the role creates a separate file for each plugin in /etc/telegraf/telegraf.d. However, each file lists all of the extra plugins.

The issue is that the task "Copy telegraf extra plugins" iterates over telegraf_plugins_extra, but the template file telegraf-extra-plugin.conf also iterates over telegraf_plugins_extra, causing duplicates.

I'm not quite expert enough in ansible to know how to fix this yet, but I'll try to find some time to play with it...

dj-wasabi commented 7 years ago

Hi @haraldkoch

Please let me know if you need help. Otherwise I'll take a look at it and fix it.

haraldkoch commented 7 years ago

Okay, the obvious fix (remove the iteration inside the file) works - until you define multiple plugins with the same type (e.g. two SNMP plugins talking to different servers). In that case, the second one doesn't get instantiated in the final output.

Back to square one :)

dj-wasabi commented 7 years ago

@haraldkoch

Can you confirm that with the merge of a PR in the last few days that this issue is solved now?

haraldkoch commented 7 years ago

@dj-wasabi Worked perfectly on my test server, yes.

dj-wasabi commented 7 years ago

Thanks! Will close this issue and create a release in the next few days.