-
Notifications
You must be signed in to change notification settings - Fork 232
Open
Description
When installing the DD agent, the task Check if remote update is in progress runs to see if the datadog-install.exe is running
From: windows_remote_update_check.yml
- name: Check if remote update is in progress
ansible.windows.win_shell: |
Get-CimInstance Win32_Process | Where-Object {
$_.Name -eq "datadog-installer.exe" -and
$_.CommandLine -match "postStartExperimentBackground"
}
register: remote_update_check
- name: Update remote update flag if installer is running
ansible.builtin.set_fact:
datadog_remote_update_in_progress: true
when:
- remote_update_check.stdout is defined
- remote_update_check.stdout | trim | length > 0
But, it assumes that any output from the command is the installer exe running and skips later tasks.
If for instance you have a default profile script that includes any STDOUT text the Update remote update flag if installer is running task will be set to true even if the exe isn't running.
TASK [datadog.dd.agent : Check if remote update is in progress] ******************************************************************************************************************************************************
task path: /home/richard.dzien/.ansible/collections/ansible_collections/datadog/dd/roles/agent/tasks/windows_remote_update_check.yml:6
Using module file /usr/lib/python3.12/site-packages/ansible_collections/ansible/windows/plugins/modules/win_shell.ps1
Pipelining is enabled.
<server-01> ESTABLISH WINRM CONNECTION FOR USER: richard.dzien on PORT 5986 TO server-01
EXEC (via pipeline wrapper)
changed: [server-01] => {
"changed": true,
"cmd": "Get-CimInstance Win32_Process | Where-Object {\n $_.Name -eq \"datadog-installer.exe\" -and\n $_.CommandLine -match \"postStartExperimentBackground\"\n}",
"delta": "0:00:04.157422",
"end": "2026-02-18 14:15:49.011822",
"rc": 0,
"start": "2026-02-18 14:15:44.854400",
"stderr": "",
"stderr_lines": [],
"stdout": "Setting up proxies, repositories and modules.\r\nShell proxy defaults are set.\r\n",
"stdout_lines": [
"Setting up proxies, repositories and modules.",
"Shell proxy defaults are set."
]
}
TASK [datadog.dd.agent : Update remote update flag if installer is running] ******************************************************************************************************************************************
task path: /home/richard.dzien/.ansible/collections/ansible_collections/datadog/dd/roles/agent/tasks/windows_remote_update_check.yml:14
ok: [server-01] => {
"ansible_facts": {
"datadog_remote_update_in_progress": true
},
"changed": false
}
TASK [datadog.dd.agent : Inform about remote update in progress] *****************************************************************************************************************************************************
task path: /home/richard.dzien/.ansible/collections/ansible_collections/datadog/dd/roles/agent/tasks/windows_remote_update_check.yml:21
ok: [server-01] => {
"msg": "Remote update is in progress. Skipping installation and restart of the Agent. Any changes to the configuration will only take effect at the next Agent restart, either manually or through a future role execution."
}
Fix is easy enough, the Update remote update flag if installer is running should also check for datadog-installer.exe in the output text.
I have tried this locally, and WFM.
- name: Update remote update flag if installer is running
ansible.builtin.set_fact:
datadog_remote_update_in_progress: true
when:
- remote_update_check.stdout is defined
- remote_update_check.stdout | trim | length > 0
- "'datadog-installer.exe' in remote_update_check.stdout"
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels