From 47533464131ca207080a2d19869c25bc6988d5fc Mon Sep 17 00:00:00 2001 From: "Aleksey @soar Smyrnov" Date: Wed, 11 Jan 2023 18:55:49 +0400 Subject: [PATCH 1/3] Don't fail if the package is already installed by default, Ansible allows following msiexec.exe exit codes: - `0` for success - `3010` for "reboot required" state but there is another code, [1603](https://learn.microsoft.com/en-us/troubleshoot/windows-server/application-management/msi-installation-error-1603), for cases, when the package is installed already. This change will allow Ansible to proceed in theese cases. --- tasks/pkg-windows.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/tasks/pkg-windows.yml b/tasks/pkg-windows.yml index 3ea0a7e3..5767fd62 100644 --- a/tasks/pkg-windows.yml +++ b/tasks/pkg-windows.yml @@ -77,6 +77,7 @@ win_package: path: "{{ download_msi_result.dest }}" arguments: "{{ win_install_args }}" + expected_return_code: [0, 1603, 3010] register: datadog_agent_install when: (not datadog_skip_install) and (not ansible_check_mode) From e73d56927a814db6ed35aa844831dd9495175ed5 Mon Sep 17 00:00:00 2001 From: "Aleksey @soar Smyrnov" Date: Mon, 5 Jun 2023 18:51:53 -0400 Subject: [PATCH 2/3] Allow code 1603 if package is already installed see: https://github.com/DataDog/ansible-datadog/pull/465 --- tasks/pkg-windows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/pkg-windows.yml b/tasks/pkg-windows.yml index 5767fd62..8ffd335c 100644 --- a/tasks/pkg-windows.yml +++ b/tasks/pkg-windows.yml @@ -77,7 +77,7 @@ win_package: path: "{{ download_msi_result.dest }}" arguments: "{{ win_install_args }}" - expected_return_code: [0, 1603, 3010] + expected_return_code: "{{ [0, 3010] + ([1603] if not (datadog_agent_version | default('', true)) else []) }}" register: datadog_agent_install when: (not datadog_skip_install) and (not ansible_check_mode) From ccdefb1bffd0ee781d3ffb8198ad8ac31546ddaf Mon Sep 17 00:00:00 2001 From: "Aleksey @soar Smyrnov" Date: Sun, 15 Oct 2023 22:26:38 +0200 Subject: [PATCH 3/3] Add code 1603 as expected unconditionally I found other cases, when 1603 can be returned; it looks like it can be expected always --- tasks/pkg-windows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/pkg-windows.yml b/tasks/pkg-windows.yml index 9ab91ed0..f07c3458 100644 --- a/tasks/pkg-windows.yml +++ b/tasks/pkg-windows.yml @@ -81,7 +81,7 @@ win_package: path: "{{ agent_download_msi_result.dest }}" arguments: "{{ agent_win_install_args }}" - expected_return_code: "{{ [0, 3010] + ([1603] if not (agent_datadog_agent_windows_version | default('', true)) else []) }}" + expected_return_code: [0, 1603, 3010] register: agent_datadog_agent_install when: (not agent_datadog_skip_install) and (not ansible_check_mode)