win_get_url – Downloads file from HTTP, HTTPS, or FTP to node
win_get_url – Downloads file from HTTP, HTTPS, or FTP to node
New in version 1.7.
Synopsis
- Downloads files from HTTP, HTTPS, or FTP to the remote server. The remote server must have direct access to the remote resource.
- For non-Windows targets, use the get_url module instead.
Parameters
Parameter | Choices/Defaults | Comments |
---|---|---|
dest path / required |
The location to save the file at the URL. Be sure to include a filename and extension as appropriate. | |
force boolean added in 2.0 |
|
If 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. |
force_basic_auth boolean added in 2.5 |
|
If If |
headers dictionary added in 2.4 |
Add custom HTTP headers to a request (as a dictionary). | |
proxy_password - added in 2.0 |
Proxy authentication password. | |
proxy_url - added in 2.0 |
The full URL of the proxy server to download through. | |
proxy_username - added in 2.0 |
Proxy authentication username. | |
skip_certificate_validation boolean |
|
This option is deprecated since v2.4, please use If |
timeout integer added in 2.4 |
Default: 10 |
Timeout in seconds for URL request. |
url - / required |
The full URL of a file to download. | |
url_password - |
Basic authentication password.
| |
url_username - |
Basic authentication username.
| |
use_proxy boolean added in 2.4 |
|
If |
validate_certs boolean added in 2.4 |
|
If If |
Examples
- name: Download earthrise.jpg to specified path
win_get_url:
url: http://www.example.com/earthrise.jpg
dest: C:\Users\RandomUser\earthrise.jpg
- name: Download earthrise.jpg to specified path only if modified
win_get_url:
url: http://www.example.com/earthrise.jpg
dest: C:\Users\RandomUser\earthrise.jpg
force: no
- name: Download earthrise.jpg to specified path through a 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
- name: Download file from FTP with authentication
win_get_url:
url: ftp://server/file.txt
dest: '%TEMP%\ftp-file.txt'
url_username: ftp-user
url_password: ftp-password
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description |
---|---|---|
dest string |
always |
destination file/path
Sample: C:\Users\RandomUser\earthrise.jpg |
msg string |
always |
Error message, or HTTP status message from web-server
Sample: OK |
status_code integer |
always |
HTTP status code
Sample: 200 |
url string |
always |
requested url
Sample: |
Status
- This module is guaranteed to have no backward incompatible interface changes going forward. [stableinterface]
- This module is maintained by the Ansible Core Team. [core]
Red Hat Support
More information about Red Hat’s support of this module is available from this Red Hat Knowledge Base article.
Authors
- Paul Durivage (@angstwad)
- Takeshi Kuramochi (@tksarah)
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.7/modules/win_get_url_module.html