dj-wasabi / ansible-telegraf

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

Setting variable telegraf_agent_package does not work as expected #150

Open NKissler opened 2 years ago

NKissler commented 2 years ago

Describe the bug When it comes to setting the variable telegraf_agent_package Debian is behaving differently from any other distro.

The README states: "telegraf_agent_package: The name of the Telegraf package to install. When telegraf_agent_package_method is set to online or offline, it needs to have the full path of the file. Example: telegraf_agent_package: /tmp/telegraf.rpm. Default: telegraf_agent_package: telegraf."

For method online setting the full path does not work with Debian. The culprit seems to be in these two lines, where the package path is built from two variables and telegraf_agent_package is expected to be only the package name: https://github.com/dj-wasabi/ansible-telegraf/blob/master/tasks/Debian.yml#L75 https://github.com/dj-wasabi/ansible-telegraf/blob/master/tasks/Debian.yml#L97

Compare to e.g. RedHat where only one variable is used which expects the full path: https://github.com/dj-wasabi/ansible-telegraf/blob/master/tasks/RedHat.yml#L30

Installation method/version

Targeted hosts Concerns the following OS(es):

Expected behavior Set variables telegraf_agent_package_method: online telegraf_agent_package: /tmp/telegraf.rpm (full package path) Rollout works for all distros.

Current behavior Set variables telegraf_agent_package_method: online telegraf_agent_package: /tmp/telegraf.rpm (full package path) -> Rollout fails for Debian. Rollout works for RedHat etc.

Set variables telegraf_agent_package_method: online telegraf_agent_package_path: /tmp telegraf_agent_package: telegraf.rpm -> Rollout works for Debian only.

Additional context Because of this bug the variable telegraf_agent_package cannot be configured to universally work with Debian AND the other distros. You can work around the problem if you are only every using the role for either Debian OR RedHat/... based systems by setting the variables as stated above under "Current behavior". This however does not apply to our setup where we maintain servers running a mixture of those distros.

egmont1227 commented 2 years ago

@dj-wasabi any news on that? Shall @noris-network provide a MR to fix it?

Might also be connected to #115 and #95

dj-wasabi commented 2 years ago

Hi @egmont1227 Sorry for late reply, but I am all open to PR's. I don't have much time lately to work on this role. I hope soon that I am able to spend some time on it again. In the mean time I accept all help. 😄 👍