Class: Ansible::Ruby::Modules::Get_url
- Inherits:
-
Base
- Object
- Ansible::Ruby::Models::Base
- Base
- Ansible::Ruby::Modules::Get_url
- Includes:
- Helpers::FileAttributes
- Defined in:
- lib/ansible/ruby/modules/generated/net_tools/basics/get_url.rb,
lib/ansible/ruby/modules/custom/net_tools/basics/get_url.rb
Overview
Downloads files from HTTP, HTTPS, or FTP to the remote server. The remote server I(must) have direct access to the remote resource. By default, if an environment variable C(<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 <docs.ansible.com/playbooks_environment.html>`_), or by using the use_proxy option. HTTP redirects can redirect from HTTP to HTTPS so you should be sure that your proxy environment for both protocols is correct. From Ansible 2.4 when run with C(–check), it will do a HEAD request to validate the URL but will not download the entire file or verify it against hashes. For Windows targets, use the M(win_get_url) module instead.
Instance Method Summary collapse
-
#backup ⇒ :yes, ...
Create a backup file including the timestamp information so you can get the original file back if you somehow clobbered it incorrectly.
-
#checksum ⇒ String?
If a 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.
-
#client_cert ⇒ Object?
PEM formatted certificate chain file to be used for SSL client authentication.
-
#client_key ⇒ Object?
PEM formatted file that contains your private key to be used for SSL client authentication.
-
#dest ⇒ String
Absolute path of where to download the file to.,If C(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.
-
#force ⇒ :yes, ...
If C(yes) and C(dest) is not a directory, will download the file every time and replace the file if the contents change.
-
#force_basic_auth ⇒ :yes, ...
Httplib2, the library used by the uri module only sends authentication information when a webservice responds to an initial request with a 401 status.
-
#headers ⇒ Hash?
Add custom HTTP headers to a request in hash/dict format.
-
#others ⇒ Object?
All arguments accepted by the M(file) module also work here.
-
#sha256sum ⇒ String?
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.
-
#timeout ⇒ Integer?
Timeout in seconds for URL request.
-
#tmp_dest ⇒ Object?
Absolute path of where temporary file is downloaded to.,When run on Ansible 2.5 or greater, path defaults to ansible’s remote_tmp setting,When run on Ansible prior to 2.5, it defaults to C(TMPDIR), C(TEMP) or C(TMP) env variables or a platform specific value.,U(docs.python.org/2/library/tempfile.html#tempfile.tempdir).
- #to_h ⇒ Object
-
#url ⇒ String
HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user]@host.domain/path.
-
#url_password ⇒ Object?
The password for use in HTTP basic authentication.,If the C(url_username) parameter is not specified, the C(url_password) parameter will not be used.
-
#url_username ⇒ Object?
The username for use in HTTP basic authentication.,This parameter can be used without C(url_password) for sites that allow empty passwords.
-
#use_proxy ⇒ :yes, ...
If C(no), it will not use a proxy, even if one is defined in an environment variable on the target hosts.
-
#validate_certs ⇒ :yes, ...
If C(no), SSL certificates will not be validated.
Methods included from Helpers::FileAttributes
Methods inherited from Base
Methods inherited from Ansible::Ruby::Models::Base
attr_option, attr_options, attribute, fix_inclusion, #initialize, remove_existing_validations, validates
Constructor Details
This class inherits a constructor from Ansible::Ruby::Models::Base
Instance Method Details
#backup ⇒ :yes, ...
Returns Create a backup file including the timestamp information so you can get the original file back if you somehow clobbered it incorrectly.
31 |
# File 'lib/ansible/ruby/modules/generated/net_tools/basics/get_url.rb', line 31 attribute :backup |
#checksum ⇒ String?
Returns If a 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. Format: <algorithm>:<checksum|url>, e.g. checksum=“sha256:D98291ACB6DC7B97”, checksum=“sha256:example.com/path/sha256sum.txt”,If you worry about portability, only the sha1 algorithm is available on all platforms and python versions.,The third party hashlib library can be installed for access to additional algorithms.,Additionally, if a checksum is passed to this parameter, and the file exist under the C(dest) location, the I(destination_checksum) would be calculated, and if checksum equals I(destination_checksum), the file download would be skipped (unless C(force) is true).
39 |
# File 'lib/ansible/ruby/modules/generated/net_tools/basics/get_url.rb', line 39 attribute :checksum |
#client_cert ⇒ Object?
Returns PEM formatted certificate chain file to be used for SSL client authentication. This file can also include the key as well, and if the key is included, C(client_key) is not required.
69 |
# File 'lib/ansible/ruby/modules/generated/net_tools/basics/get_url.rb', line 69 attribute :client_cert |
#client_key ⇒ Object?
Returns PEM formatted file that contains your private key to be used for SSL client authentication. If C(client_cert) contains both the certificate and key, this option is not required.
72 |
# File 'lib/ansible/ruby/modules/generated/net_tools/basics/get_url.rb', line 72 attribute :client_key |
#dest ⇒ String
Returns Absolute path of where to download the file to.,If C(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, C(force) has no effect.,If C(dest) is a directory, the file will always be downloaded (regardless of the C(force) option), but replaced only if the contents changed..
20 |
# File 'lib/ansible/ruby/modules/generated/net_tools/basics/get_url.rb', line 20 attribute :dest |
#force ⇒ :yes, ...
Returns If C(yes) and C(dest) is not a directory, will download the file every time and replace the file if the contents change. If C(no), the file will only be downloaded if the destination does not exist. Generally should be C(yes) only for small local files.,Prior to 0.6, this module behaved as if C(yes) was the default.
27 |
# File 'lib/ansible/ruby/modules/generated/net_tools/basics/get_url.rb', line 27 attribute :force |
#force_basic_auth ⇒ :yes, ...
Returns httplib2, the library used by the uri module only sends authentication information when a webservice responds to an initial request with a 401 status. Since some basic auth services do not properly send a 401, logins will fail. This option forces the sending of the Basic authentication header upon initial request.
65 |
# File 'lib/ansible/ruby/modules/generated/net_tools/basics/get_url.rb', line 65 attribute :force_basic_auth |
#headers ⇒ Hash?
Returns Add custom HTTP headers to a request in hash/dict format. The hash/dict format was added in 2.6. Previous versions used a C(“key:value,key:value”) string format. The C(“key:value,key:value”) string format is deprecated and will be removed in version 2.10.
55 |
# File 'lib/ansible/ruby/modules/generated/net_tools/basics/get_url.rb', line 55 attribute :headers |
#others ⇒ Object?
Returns all arguments accepted by the M(file) module also work here.
75 |
# File 'lib/ansible/ruby/modules/generated/net_tools/basics/get_url.rb', line 75 attribute :others |
#sha256sum ⇒ String?
Returns 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. This option is deprecated. Use C(checksum) instead.
35 |
# File 'lib/ansible/ruby/modules/generated/net_tools/basics/get_url.rb', line 35 attribute :sha256sum |
#timeout ⇒ Integer?
Returns Timeout in seconds for URL request.
51 |
# File 'lib/ansible/ruby/modules/generated/net_tools/basics/get_url.rb', line 51 attribute :timeout |
#tmp_dest ⇒ Object?
Returns Absolute path of where temporary file is downloaded to.,When run on Ansible 2.5 or greater, path defaults to ansible’s remote_tmp setting,When run on Ansible prior to 2.5, it defaults to C(TMPDIR), C(TEMP) or C(TMP) env variables or a platform specific value.,U(docs.python.org/2/library/tempfile.html#tempfile.tempdir).
24 |
# File 'lib/ansible/ruby/modules/generated/net_tools/basics/get_url.rb', line 24 attribute :tmp_dest |
#to_h ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/ansible/ruby/modules/custom/net_tools/basics/get_url.rb', line 14 def to_h result = super data = result[:get_url] # Ansible expects a string for some reason if data.include? :headers data[:headers] = data[:headers].map do |key, value| "#{key}:#{value}" end.join ',' end result end |
#url ⇒ String
Returns HTTP, HTTPS, or FTP URL in the form (http|https|ftp)://[user]@host.domain/path.
16 |
# File 'lib/ansible/ruby/modules/generated/net_tools/basics/get_url.rb', line 16 attribute :url |
#url_password ⇒ Object?
Returns The password for use in HTTP basic authentication.,If the C(url_username) parameter is not specified, the C(url_password) parameter will not be used.
62 |
# File 'lib/ansible/ruby/modules/generated/net_tools/basics/get_url.rb', line 62 attribute :url_password |
#url_username ⇒ Object?
Returns The username for use in HTTP basic authentication.,This parameter can be used without C(url_password) for sites that allow empty passwords.
59 |
# File 'lib/ansible/ruby/modules/generated/net_tools/basics/get_url.rb', line 59 attribute :url_username |
#use_proxy ⇒ :yes, ...
Returns if C(no), it will not use a proxy, even if one is defined in an environment variable on the target hosts.
43 |
# File 'lib/ansible/ruby/modules/generated/net_tools/basics/get_url.rb', line 43 attribute :use_proxy |
#validate_certs ⇒ :yes, ...
Returns If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.
47 |
# File 'lib/ansible/ruby/modules/generated/net_tools/basics/get_url.rb', line 47 attribute :validate_certs |