[AGENTONB-2680][Windows] Provide users a way to skip and force reinstall of Datadog Agent #683
+60
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do
Introduces for Windows two new parameters publicly available:
datadog_windows_skip_install: skip install-related tasksdatadog_windows_force_reinstall: force reinstallation:Motivation
Currently, we have internal facts:
agent_datadog_skip_install: skip install if we detect the desired version is already installed. On Windows, unlike Linux, not specifying a version always re-installs latest since we can't know unlike on Linux when using package managersagent_datadog_force_reinstall: force reinstall if NPM is enabledansible-datadog/tasks/pkg-windows-opts.yml
Lines 117 to 120 in 8218ea5
Now, this logic can be overridden explicitly by users providing these values in their playbook.
QA
Already tested on Windows:
datadog_windows_skip_install: on a bare VM (no Agent installed), use a playbook withdatadog_windows_skip_install: trueand ensure the Agent doesn't get installed, it will error out later sinceC:\ProgramData\Datadogdoes not existdatadog_windows_skip_installdatadog_windows_skip_installdatadog_windows_force_reinstall: providedatadog_windows_force_reinstall: trueanddatadog_agent_versionand ensure the same version gets re-installed / provide a lowerdatadog_agent_versionand it should downgrade instead of erroring. Example below starting from7.72.2and trying to downgrade to7.70.1datadog_windows_force_reinstalldatadog_windows_force_reinstall