ansible-datadog icon indicating copy to clipboard operation
ansible-datadog copied to clipboard

Role downloads agent when current version is already up to date

Open marchenm opened this issue 4 years ago • 8 comments

On windows, the role isn't idempotent. It will download the agent every single time even when there isn't a change. There should be a preliminary version check before downloading the agent.

marchenm avatar Mar 05 '20 17:03 marchenm

Hi @marchenm,

Thanks for the report! I made a PR: #269 to add logic to not download the msi if the detected installed version is the same as the set datadog_agent_version, which should fix the idempotency problem for pinned installs (for "latest" installs, the problem is more complex since we can't currently know what the latest package will install without downloading it, so this PR doesn't cover it).

KSerrania avatar Mar 06 '20 17:03 KSerrania

https://docs.ansible.com/ansible/latest/modules/github_release_module.html

This module should be able to give you the latest release version

marchenm avatar Mar 06 '20 17:03 marchenm

Thanks for the suggestion, however while this module could help in some cases, using the github releases won't work everytime, for two main reasons:

  • there can be linux-only or windows-only releases of the datadog-agent (especially bugfix releases); if the latest release is a linux-only release, this module would return a version that doesn't exist on Windows,
  • moreover, this will only work for Agent 7 installs (as the Agent 6 and Agent 7 releases are published on the same repository).

KSerrania avatar Mar 06 '20 18:03 KSerrania

We're using Ansible to automatically update Datadog, and we'd like to do this rather frequently. However, due to the fact that this Ansible role always downloads the installer, the process can take extremely long. This doesn't scale to multiple servers very well, so it'd be nice to see an improvement.

Any chance of this issue being resolved?

joeriharleman avatar Jan 15 '21 07:01 joeriharleman

Hi Joeri! Your concern is valid and it is something we should fix, but that we haven't prioritized yet. I'll bump it internally. Note, though, that not pinning a version is not the recommended configuration of the role. If you pin a specific version of the Agent to install (and update it manually when you think it is convenient) then it won't download the MSI again on each run. Also, pinning ensures that you won't get updates at a time when you don't want them, which is the main reason we recommend it.

albertvaka avatar Jan 15 '21 11:01 albertvaka

Agreed, more idempotency in this role, please.

grizzlyhazard avatar Aug 11 '22 16:08 grizzlyhazard

@grizzlyhazard hi 👋 do you have any other issues specifically other than the one reported in the root comment here? If so, I'd definitely like to know what they are - feel free to open more issues or note them here. Thanks!

bkabrda avatar Aug 15 '22 12:08 bkabrda

Thanks for looking into this! 🙏 And +1 on somehow allowing to run the role, even with "latest", and not reinstalling on each run. We're also running a playbook daily, and while we want to pick up updates by default for now, not re-installing in case it hasn't would be wonderful.

diederich avatar Sep 14 '22 12:09 diederich