diff --git a/changelogs/fragments/50185-win_updates-report-changes-correctly.yml b/changelogs/fragments/50185-win_updates-report-changes-correctly.yml new file mode 100644 index 0000000000..fe8873933d --- /dev/null +++ b/changelogs/fragments/50185-win_updates-report-changes-correctly.yml @@ -0,0 +1,3 @@ +--- +bugfixes: +- win_updates - Correctly report changes on success diff --git a/lib/ansible/modules/windows/win_updates.ps1 b/lib/ansible/modules/windows/win_updates.ps1 index b9df9d1610..ff9df50322 100644 --- a/lib/ansible/modules/windows/win_updates.ps1 +++ b/lib/ansible/modules/windows/win_updates.ps1 @@ -350,6 +350,10 @@ $update_script_block = { $result.installed_update_count = $update_success_count $result.failed_update_count = $update_fail_count + if ($updates_success_count -gt 0) { + $result.changed = $true + } + if ($update_fail_count -gt 0) { $result.failed = $true $result.msg = "Failed to install one or more updates"