Author: | Jan-Piet Mens |
---|
Downloads files from HTTP, HTTPS, or FTP to the remote server. The remote server must have direct access to the remote resource. By default, if an environment variable <protocol>_proxy is set on the target host, requests will be sent through that proxy. This behaviour can be overridden by setting a variable for this task (see setting the environment), or by using the use_proxy option.
parameter | required | default | choices | comments |
---|---|---|---|---|
dest | yes | absolute path of where to download the file to.If dest is a directory, either the server provided filename or, if none provided, the base name of the URL on the remote server will be used. If a directory, force has no effect. If dest is a directory, the file will always be downloaded (regardless of the force option), but replaced only if the contents changed. |
||
force | no | no |
|
If yes and dest is not a directory, will download the file every time and replace the file if the contents change. If no , the file will only be downloaded if the destination does not exist. Generally should be yes only for small local files. Prior to 0.6, this module behaved as if yes was the default. (added in Ansible 0.7) |
others | no | all arguments accepted by the file module also work here | ||
sha256sum | no | If a SHA-256 checksum is passed to this parameter, the digest of the destination file will be calculated after it is downloaded to ensure its integrity and verify that the transfer completed successfully. (added in Ansible 1.3) | ||
url | yes | HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user[:pass]]@host.domain[:port]/path | ||
use_proxy | no | yes |
|
if no , it will not use a proxy, even if one is defined in an environment variable on the target hosts. |
validate_certs | no | yes |
|
If no , SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. |
Note
Requires urllib2
Note
Requires urlparse
- name: download foo.conf
get_url: url=http://example.com/path/file.conf dest=/etc/foo.conf mode=0440
- name: download file with sha256 check
get_url: url=http://example.com/path/file.conf dest=/etc/foo.conf sha256sum=b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c
Note
This module doesn’t yet support configuration for proxies.