dj-wasabi / ansible-telegraf

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

Don't override package name unless "latest" #108

Closed matttrach closed 5 years ago

matttrach commented 5 years ago

Description of PR

Flip conditional to prevent override of package name unless 'latest' flag is given

Type of change

Bugfix Pull Request

Fixes an issue

https://github.com/dj-wasabi/ansible-telegraf/issues/95

matttrach commented 5 years ago

The failing lint test has nothing to do with my change.


    [204] Lines should be no longer than 160 chars
    /home/travis/build/dj-wasabi/ansible-telegraf/tasks/Debian.yml:68
        url: https://dl.influxdata.com/telegraf/releases/telegraf_{{ telegraf_agent_version }}-{{ telegraf_agent_version_patch }}_{{ telegraf_agent_package_arch }}.deb
dj-wasabi commented 5 years ago

Thanks! 👍

I'll try to fix the error tonight, as this has indeed nothing to do with your change.

sdurrheimer commented 5 years ago

Hi there,

This modification is actually introducing a regression.

Before that we could use telegraf_agent_package_state: latest as a way to not take into account the often out-of-date telegraf_agent_version variable.

As influxdata repositories doesn't keep an history of the previous versions of their package, this playbook will break everytime they release a new version.

gaelL commented 5 years ago

Adding some ref https://github.com/dj-wasabi/ansible-telegraf/pull/92

sdurrheimer commented 5 years ago

After some investigation, this PR should actually be reverted.

You can't set the fact telegraf_agent_package: telegraf={{ telegraf_agent_version }}-{{ telegraf_agent_version_patch }} when telegraf_agent_package_state: latest because it will result to the following error:

TASK [dj-wasabi.telegraf : Debian | Install Telegraf package] ******************
    FAILED - RETRYING: Debian | Install Telegraf package (3 retries left).
    FAILED - RETRYING: Debian | Install Telegraf package (2 retries left).
    FAILED - RETRYING: Debian | Install Telegraf package (1 retries left).
    fatal: [instance]: FAILED! => {"attempts": 3, "changed": false, "msg": "version number inconsistent with state=latest: telegraf=1.12.0-1"}

When telegraf_agent_package_state: latest, telegraf_agent_package should be telegraf.

matttrach commented 5 years ago

Maybe instead of reverting this change, a new change to convert the ’telegraf_agent_package’ variable to ‘telegraf’ when latest is set?