diff --git a/lib/ansible/modules/windows/win_chocolatey.ps1 b/lib/ansible/modules/windows/win_chocolatey.ps1 index 562beab2df..a04fe49f4e 100644 --- a/lib/ansible/modules/windows/win_chocolatey.ps1 +++ b/lib/ansible/modules/windows/win_chocolatey.ps1 @@ -100,7 +100,7 @@ Function Choco-IsInstalled [string]$package ) - $cmd = "$executable list --local-only $package" + $cmd = "$executable list --local-only --exact $package" $output = invoke-expression $cmd $result.rc = $LastExitCode @@ -249,7 +249,7 @@ Function Choco-Install if (Choco-IsInstalled $package) { - if ($upgrade) + if ($state -eq "latest") { Choco-Upgrade -package $package -version $version -source $source -force $force ` -installargs $installargs -packageparams $packageparams `