From 2cc212fb377fa252ac9bdbba62e3d999efa242ee Mon Sep 17 00:00:00 2001 From: = Date: Fri, 27 May 2016 18:53:35 +0100 Subject: [PATCH 1/2] document how force=no works for win_get_url and add RETURN --- windows/win_get_url.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/windows/win_get_url.py b/windows/win_get_url.py index 1492cb44f05..5ce3bd522db 100644 --- a/windows/win_get_url.py +++ b/windows/win_get_url.py @@ -47,7 +47,10 @@ options: description: - If C(yes), will always download the file. If C(no), will only download the file if it does not exist or the remote file has been - modified more recently than the local file. + modified more recently than the local file. This works by sending + an http HEAD request to retrieve last modified time of the requested + resource, so for this to work, the remote web server must support + HEAD requests. version_added: "2.0" required: false choices: [ "yes", "no" ] @@ -109,3 +112,15 @@ $ ansible -i hosts -c winrm -m win_get_url -a "url=http://www.example.com/earthr proxy_username: 'username' proxy_password: 'password' ''' +RETURN = ''' +url: + description: requested url + returned: always + type: string + sample: 'http://www.example.com/earthrise.jpg' +dest: + description: destination file/path + returned: always + type: string + sample: 'C:\Users\RandomUser\earthrise.jpg' +''' From 1a57ac67bdafa0d56b5d7323f4a4fbf8eacb3387 Mon Sep 17 00:00:00 2001 From: = Date: Tue, 31 May 2016 12:40:53 +0100 Subject: [PATCH 2/2] double backslashed all single backslashes to keep travis happy --- windows/win_get_url.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/windows/win_get_url.py b/windows/win_get_url.py index 5ce3bd522db..041eb563d00 100644 --- a/windows/win_get_url.py +++ b/windows/win_get_url.py @@ -90,24 +90,24 @@ options: EXAMPLES = r''' # Downloading a JPEG and saving it to a file with the ansible command. # Note the "dest" is quoted rather instead of escaping the backslashes -$ ansible -i hosts -c winrm -m win_get_url -a "url=http://www.example.com/earthrise.jpg dest='C:\Users\Administrator\earthrise.jpg'" all +$ ansible -i hosts -c winrm -m win_get_url -a "url=http://www.example.com/earthrise.jpg dest='C:\\Users\\Administrator\\earthrise.jpg'" all # Playbook example -- name: Download earthrise.jpg to 'C:\Users\RandomUser\earthrise.jpg' +- name: Download earthrise.jpg to 'C:\\Users\\RandomUser\\earthrise.jpg' win_get_url: url: 'http://www.example.com/earthrise.jpg' - dest: 'C:\Users\RandomUser\earthrise.jpg' + dest: 'C:\\Users\\RandomUser\\earthrise.jpg' -- name: Download earthrise.jpg to 'C:\Users\RandomUser\earthrise.jpg' only if modified +- name: Download earthrise.jpg to 'C:\\Users\\RandomUser\\earthrise.jpg' only if modified win_get_url: url: 'http://www.example.com/earthrise.jpg' - dest: 'C:\Users\RandomUser\earthrise.jpg' + dest: 'C:\\Users\\RandomUser\\earthrise.jpg' force: no -- name: Download earthrise.jpg to 'C:\Users\RandomUser\earthrise.jpg' through a proxy server. +- name: Download earthrise.jpg to 'C:\\Users\\RandomUser\\earthrise.jpg' through a proxy server. win_get_url: url: 'http://www.example.com/earthrise.jpg' - dest: 'C:\Users\RandomUser\earthrise.jpg' + dest: 'C:\\Users\\RandomUser\\earthrise.jpg' proxy_url: 'http://10.0.0.1:8080' proxy_username: 'username' proxy_password: 'password' @@ -122,5 +122,5 @@ dest: description: destination file/path returned: always type: string - sample: 'C:\Users\RandomUser\earthrise.jpg' + sample: 'C:\\Users\\RandomUser\\earthrise.jpg' '''