summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorT.Kuramochi <takeshi@tkvine.(none)>2015-08-28 14:46:08 +0900
committernitzmahone <mdavis@ansible.com>2015-12-19 00:28:12 -0800
commit40e823d2383fe0a4e19f49cd0fffc66f098c1ae9 (patch)
tree10a978590ab0b1ad5755cb12b9380523c72c72ad
parentb3dff4bacffddf8310133b0fc367ca0be64526e6 (diff)
downloadansible-modules-core-40e823d2383fe0a4e19f49cd0fffc66f098c1ae9.tar.gz
Add HTTP Proxy options
Update a document file for win_get_url.ps1. Update add a prefix proxy_ for this variables Update a document file for win_get_url.ps1. Update win_get_url.ps1 20150907
-rw-r--r--windows/win_get_url.ps112
-rw-r--r--windows/win_get_url.py32
2 files changed, 44 insertions, 0 deletions
diff --git a/windows/win_get_url.ps1 b/windows/win_get_url.ps1
index 7fc96f15..3748518c 100644
--- a/windows/win_get_url.ps1
+++ b/windows/win_get_url.ps1
@@ -49,6 +49,10 @@ $skip_certificate_validation = Get-Attr $params "skip_certificate_validation" $f
$username = Get-Attr $params "username"
$password = Get-Attr $params "password"
+$proxy_url = $params.proxy_url
+$proxy_username = $params.proxy_username
+$proxy_password = $params.proxy_password
+
if($skip_certificate_validation){
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}
}
@@ -57,6 +61,14 @@ $force = Get-Attr -obj $params -name "force" "yes" | ConvertTo-Bool
If ($force -or -not (Test-Path $dest)) {
$client = New-Object System.Net.WebClient
+ if($params.proxy_url) {
+ $proxy_url = $params.proxy_url
+ if($proxy_username -and $proxy_password){
+ $proxy_credential = New-Object System.Net.NetworkCredential($proxy_username, $proxy_password)
+ $proxy_server.Credentials = $proxy_credential
+ }
+ $client.Proxy = $proxy_server
+ }
if($username -and $password){
$client.Credentials = New-Object System.Net.NetworkCredential($username, $password)
diff --git a/windows/win_get_url.py b/windows/win_get_url.py
index 5c3e994d..cfe93982 100644
--- a/windows/win_get_url.py
+++ b/windows/win_get_url.py
@@ -65,6 +65,30 @@ options:
- Skip SSL certificate validation if true
required: false
default: false
+ proxy_url:
+ description:
+ - The full URL of the proxy server a file to download through it.
+ version_added: "2.0"
+ required: false
+ choices: null
+ default: null
+ proxy_username:
+ description:
+ - Name of the user for authorization of the proxy server.
+ version_added: "2.0"
+ required: false
+ choices: null
+ default: null
+ proxy_password:
+ description:
+ - Password of the user for authorization of the proxy server.
+ version_added: "2.0"
+ required: false
+ choices: null
+ default: null
+author:
+ - "Paul Durivage (@angstwad)"
+ - "Takeshi Kuramochi (tksarah)"
'''
EXAMPLES = '''
@@ -83,4 +107,12 @@ $ ansible -i hosts -c winrm -m win_get_url -a "url=http://www.example.com/earthr
url: 'http://www.example.com/earthrise.jpg'
dest: 'C:\Users\RandomUser\earthrise.jpg'
force: no
+
+- name: Download earthrise.jpg to 'C:\Users\RandomUser\earthrise.jpg' through the proxy server.
+ win_get_url:
+ url: 'http://www.example.com/earthrise.jpg'
+ dest: 'C:\Users\RandomUser\earthrise.jpg'
+ proxy_url: 'http://10.0.0.1:8080'
+ proxy_username: 'username'
+ proxy_password: 'password'
'''