diff --git a/changelogs/fragments/win_chocolatey.yaml b/changelogs/fragments/win_chocolatey.yaml new file mode 100644 index 00000000000..65677f83333 --- /dev/null +++ b/changelogs/fragments/win_chocolatey.yaml @@ -0,0 +1,2 @@ +bugfixes: +- win_chocolatey - Fix hang when used with proxy for the first time - https://github.com/ansible/ansible/issues/47669 diff --git a/lib/ansible/modules/windows/win_chocolatey.ps1 b/lib/ansible/modules/windows/win_chocolatey.ps1 index 68174967e09..234447cfa91 100644 --- a/lib/ansible/modules/windows/win_chocolatey.ps1 +++ b/lib/ansible/modules/windows/win_chocolatey.ps1 @@ -213,6 +213,7 @@ Function Install-Chocolatey { if ($proxy_url) { # the env values are used in the install.ps1 script when getting # external dependencies + $environment = [Environment]::GetEnvironmentVariables() $environment.chocolateyProxyLocation = $proxy_url $web_proxy = New-Object -TypeName System.Net.WebProxy -ArgumentList $proxy_url, $true $client.Proxy = $web_proxy