Suggestions http proxy setting for win_get_url

Hello,

I think that some enterprise user make have an authentication http proxy when they use win_get_url module.
It is useful to get this module has parameter for these.

For example playbook;

  • name: Grab download file
    tags: pscx

win_get_url:
url: ‘https://example.com/download-file.jpg
proxy_url: ‘http://10.0.0.1:8080
user: ‘username’
pass: ‘password’
dest: ‘/tmp/download-file.jpg’

For example win_get_url.ps1 for v2.0.0-0.1;

Sorry, I have a error.

Edit example of win_get_url.ps1;

— win_get_url.ps1 2015-08-28 03:05:01.184000479 +0000
+++ org_win_get_url.ps1 2015-08-28 00:15:10.000000000 +0000
@@ -44,15 +44,6 @@ $force = Get-Attr -obj $params -name "fo

If ($force -or -not (Test-Path $dest)) {
$client = New-Object System.Net.WebClient

  • if($params.proxy_url) {
  • $proxy_url = $params.proxy_url
  • $user = $params.user
  • $pass = $params.pass
  • $proxy_server = New-Object System.Net.WebProxy($proxy_url, $true)
  • $credential = New-Object System.Net.NetworkCredential($user, $pass)
  • $proxy_server.Credentials = $credential
  • $client.Proxy = $proxy_server
  • }

Try {
$client.DownloadFile($url, $dest)

2015年8月28日金曜日 11時55分18秒 UTC+9 Takeshi Kuramochi: