mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 22:02:50 +00:00
win_get_url: Add use_proxy, headers and timeout (#26612)
* win_get_url: Add use_proxy, headers and timeout This PR includes: - Add use_proxy parameter - Add timeout parameter - Add headers parameter - Simplify logic - Create separate CheckModified-File - Now use -LiteralPath instead of -Path - Clean up documentation * win_get_url: Add use_proxy, headers and timeout This PR includes: - Add use_proxy parameter - Add timeout parameter - Add headers parameter - Simplify logic - Create separate CheckModified-File - Now use -LiteralPath instead of -Path - Clean up documentation
This commit is contained in:
committed by
Jordan Borean
parent
b84a48caef
commit
61d2201a2d
@@ -31,75 +31,84 @@ module: win_get_url
|
||||
version_added: "1.7"
|
||||
short_description: Fetches a file from a given URL
|
||||
description:
|
||||
- Fetches a file from a URL and saves to locally
|
||||
- For non-Windows targets, use the M(get_url) module instead.
|
||||
- Fetches a file from a URL and saves it locally.
|
||||
- For non-Windows targets, use the M(get_url) module instead.
|
||||
author:
|
||||
- "Paul Durivage (@angstwad)"
|
||||
- "Takeshi Kuramochi (tksarah)"
|
||||
- Paul Durivage (@angstwad)
|
||||
- Takeshi Kuramochi (tksarah)
|
||||
options:
|
||||
url:
|
||||
description:
|
||||
- The full URL of a file to download
|
||||
required: true
|
||||
default: null
|
||||
- The full URL of a file to download.
|
||||
required: yes
|
||||
dest:
|
||||
description:
|
||||
- The absolute path of the location to save the file at the URL. Be sure
|
||||
to include a filename and extension as appropriate.
|
||||
required: true
|
||||
default: null
|
||||
- The location to save the file at the URL.
|
||||
- Be sure to include a filename and extension as appropriate.
|
||||
required: yes
|
||||
force:
|
||||
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.
|
||||
- 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
|
||||
default: 'yes'
|
||||
version_added: "2.0"
|
||||
required: false
|
||||
choices: [ "yes", "no" ]
|
||||
default: yes
|
||||
username:
|
||||
headers:
|
||||
description:
|
||||
- Basic authentication username
|
||||
required: false
|
||||
default: null
|
||||
password:
|
||||
- Add custom HTTP headers to a request (as a dictionary).
|
||||
version_added: '2.4'
|
||||
url_username:
|
||||
description:
|
||||
- Basic authentication password
|
||||
required: false
|
||||
default: null
|
||||
- Basic authentication username.
|
||||
aliases: [ username ]
|
||||
url_password:
|
||||
description:
|
||||
- Basic authentication password.
|
||||
aliases: [ password ]
|
||||
skip_certificate_validation:
|
||||
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.
|
||||
default: 'no'
|
||||
type: bool
|
||||
default: 'no'
|
||||
validate_certs:
|
||||
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.
|
||||
default: 'yes'
|
||||
type: bool
|
||||
default: 'yes'
|
||||
version_added: '2.4'
|
||||
proxy_url:
|
||||
description:
|
||||
- The full URL of the proxy server to download through.
|
||||
- The full URL of the proxy server to download through.
|
||||
version_added: "2.0"
|
||||
required: false
|
||||
proxy_username:
|
||||
description:
|
||||
- Proxy authentication username
|
||||
- Proxy authentication username.
|
||||
version_added: "2.0"
|
||||
required: false
|
||||
proxy_password:
|
||||
description:
|
||||
- Proxy authentication password
|
||||
- Proxy authentication password.
|
||||
version_added: "2.0"
|
||||
required: false
|
||||
use_proxy:
|
||||
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
|
||||
default: 'yes'
|
||||
version_added: '2.4'
|
||||
# TODO: Once we have implemented DownloadFile() using $WebRequest, enable timeout again
|
||||
# timeout:
|
||||
# description:
|
||||
# - Timeout in seconds for URL request.
|
||||
# default: 10
|
||||
# version_added : '2.5'
|
||||
notes:
|
||||
- For non-Windows targets, use the M(get_url) module instead.
|
||||
'''
|
||||
@@ -126,14 +135,24 @@ EXAMPLES = r'''
|
||||
'''
|
||||
|
||||
RETURN = r'''
|
||||
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
|
||||
url:
|
||||
description: requested url
|
||||
returned: always
|
||||
type: string
|
||||
sample: http://www.example.com/earthrise.jpg
|
||||
msg:
|
||||
description: Error message, or HTTP status message from web-server
|
||||
returned: always
|
||||
type: string
|
||||
sample: OK
|
||||
status_code:
|
||||
description: HTTP status code
|
||||
returned: always
|
||||
type: int
|
||||
sample: 200
|
||||
'''
|
||||
|
||||
Reference in New Issue
Block a user