ansible / ansible.builtin / v2.7.16 / module / win_get_url Downloads file from HTTP, HTTPS, or FTP to node | "added in version" 1.7 of ansible.builtin" Authors: Paul Durivage (@angstwad), Takeshi Kuramochi (@tksarah) stableinterface | supported by coreansible.builtin.win_get_url (v2.7.16) — module
pip
Install with pip install ansible==2.7.16
Downloads files from HTTP, HTTPS, or FTP to the remote server. The remote server I(must) have direct access to the remote resource.
For non-Windows targets, use the M(get_url) module instead.
- 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
url: description: - The full URL of a file to download. required: true dest: description: - The location to save the file at the URL. - Be sure to include a filename and extension as appropriate. required: true type: path force: default: 'yes' 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. - 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. type: bool version_added: '2.0' version_added_collection: ansible.builtin headers: description: - Add custom HTTP headers to a request (as a dictionary). type: dict version_added: '2.4' version_added_collection: ansible.builtin timeout: default: 10 description: - Timeout in seconds for URL request. type: int version_added: '2.4' version_added_collection: ansible.builtin proxy_url: description: - The full URL of the proxy server to download through. version_added: '2.0' version_added_collection: ansible.builtin use_proxy: default: 'yes' description: - If C(no), it will not use a proxy, even if one is defined in an environment variable on the target hosts. type: bool version_added: '2.4' version_added_collection: ansible.builtin url_password: aliases: - password description: - Basic authentication password. url_username: aliases: - username description: - Basic authentication username. proxy_password: description: - Proxy authentication password. version_added: '2.0' version_added_collection: ansible.builtin proxy_username: description: - Proxy authentication username. version_added: '2.0' version_added_collection: ansible.builtin validate_certs: default: 'yes' description: - If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. - If C(skip_certificate_validation) was set, it overrides this option. type: bool version_added: '2.4' version_added_collection: ansible.builtin force_basic_auth: default: 'no' description: - If C(yes), will add a Basic authentication header on the initial request. - If C(no), will use Microsoft's WebClient to handle authentication. type: bool version_added: '2.5' version_added_collection: ansible.builtin skip_certificate_validation: default: 'no' description: - This option is deprecated since v2.4, please use C(validate_certs) instead. - If C(yes), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. type: bool
dest: description: destination file/path returned: always sample: C:\Users\RandomUser\earthrise.jpg type: string msg: description: Error message, or HTTP status message from web-server returned: always sample: OK type: string status_code: description: HTTP status code returned: always sample: 200 type: int url: description: requested url returned: always sample: http://www.example.com/earthrise.jpg type: string