Closed jgeusebroek closed 4 years ago
This works, however it defaults to config file < 0.10. There should be a better check in place to check the installed version.
A workaround could be if not a version (ie. alpine, or latest) then it's > 0.10 for sure. If it is a version compare the version number.
Any thoughts?
Hi @jgeusebroek I have no idea. Do you have a suggestion?
facing this issue as well
@Puneeth-n
Suggestion in how to continue with the issue @jgeusebroek mentinoned?
I have merged #135 which will work better, so I will be closing this PR.
fatal: [xxx.xxx]: FAILED! => {"msg": "The conditional check 'telegraf_agent_version is version('0.10.0', '<')' failed. The error was: Version comparison: '<' not supported between instances of 'str' and 'int'\n\nThe error appears to be in '/path/to/roles/dj-wasabi.telegraf/tasks/configure_linux.yml': line 24, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: \"Copy the template for versions < 0.10.0\"\n ^ here\n"}
Hi @jgeusebroek
I have used telegraf_agent_version: '0.2.4'
this with Molecule as a test to see why it failes, but it workes in my case:
TASK [ansible-telegraf : Retrieve all ec2 tags on the instance] ****************
skipping: [telegraf-centos8]
TASK [ansible-telegraf : Copy the template for versions < 0.10.0] **************
changed: [telegraf-centos8]
TASK [ansible-telegraf : Copy the template for versions >= 0.10.0] *************
skipping: [telegraf-centos8]
How did you have configured the version?
Kind regards, Werner
Hi Werner, the problem occurs when using a non integer (named) version. Like "latest".
Hi @jgeusebroek
Ok, clear. The telegraf_agent_version
should contain a specific version to be installed. It does not handle latest
. If you want to make use of the actual latest version, then you'll have to set the property telegraf_agent_package_state: latest
. Then it ignores the telegraf_agent_version
property/value.
Kind regards, Werner
Thanks for the reply, but this will fail when using the docker image. Forcing an int, should solve the error. AFAIK it will not have any downsides.
telegraf_agent_version | int is version('0.10.0', '<')
@jgeusebroek
Yes, true indeed. I will create a PR after my lunch walk. Will let you know.
Fixes the version comparison when not using a integer.