ansible / ansible.builtin / v2.8.15 / module / win_uri Interacts with webservices | "added in version" 2.1 of ansible.builtin" Authors: Corwin Brown (@blakfeld), Dag Wieers (@dagwieers) preview | supported by communityansible.builtin.win_uri (v2.8.15) — module
pip
Install with pip install ansible==2.8.15
Interacts with FTP, HTTP and HTTPS web services.
Supports Digest, Basic and WSSE HTTP authentication mechanisms.
For non-Windows targets, use the M(uri) module instead.
- name: Perform a GET and Store Output win_uri: url: http://example.com/endpoint register: http_output
# Set a HOST header to hit an internal webserver: - name: Hit a Specific Host on the Server win_uri: url: http://example.com/ method: GET headers: host: www.somesite.com
- name: Perform a HEAD on an Endpoint win_uri: url: http://www.example.com/ method: HEAD
- name: POST a Body to an Endpoint win_uri: url: http://www.somesite.com/ method: POST body: "{ 'some': 'json' }"
url: description: - Supports FTP, HTTP or HTTPS URLs in the form of (ftp|http|https)://host.domain:port/path. required: true type: str body: description: - The body of the HTTP request/response to the web service. type: raw dest: description: - Output the response body to a file. type: path version_added: '2.3' version_added_collection: ansible.builtin user: description: - Username to use for authentication. type: str version_added: '2.4' version_added_collection: ansible.builtin method: default: GET description: - The HTTP Method of the request or response. type: str creates: description: - A filename, when it already exists, this step will be skipped. type: path version_added: '2.4' version_added_collection: ansible.builtin headers: description: - Extra headers to set on the request, see the examples for more details on how to set this. type: dict removes: description: - A filename, when it does not exist, this step will be skipped. type: path version_added: '2.4' version_added_collection: ansible.builtin timeout: default: 30 description: - Specifies how long the request can be pending before it times out (in seconds). - The value 0 (zero) specifies an indefinite time-out. - A Domain Name System (DNS) query can take up to 15 seconds to return or time out. If your request contains a host name that requires resolution, and you set C(timeout) to a value greater than zero, but less than 15 seconds, it can take 15 seconds or more before your request times out. type: int version_added: '2.4' version_added_collection: ansible.builtin password: description: - Password to use for authentication. type: str version_added: '2.4' version_added_collection: ansible.builtin client_cert: description: - Specifies the client certificate (.pfx) that is used for a secure web request. - The WinRM connection must be authenticated with C(CredSSP) if the certificate file is not password protected. - Other authentication types can set I(client_cert_password) when the cert is password protected. type: path version_added: '2.4' version_added_collection: ansible.builtin status_code: default: - 200 description: - A valid, numeric, HTTP status code that signifies success of the request. - Can also be comma separated list of status codes. type: list version_added: '2.4' version_added_collection: ansible.builtin content_type: description: - Sets the "Content-Type" header. type: str return_content: default: false description: - Whether or not to return the body of the response as a "content" key in the dictionary result. If the reported Content-type is "application/json", then the JSON is additionally loaded into a key called C(json) in the dictionary results. type: bool version_added: '2.4' version_added_collection: ansible.builtin validate_certs: default: true description: - If C(no), SSL certificates will not be validated. This should only set to C(no) used on personally controlled sites using self-signed certificates. type: bool version_added: '2.4' version_added_collection: ansible.builtin follow_redirects: choices: - all - none - safe default: safe description: - Whether or not the C(win_uri) module should follow redirects. - C(all) will follow all redirects. - C(none) will not follow any redirects. - C(safe) will follow only "safe" redirects, where "safe" means that the client is only doing a C(GET) or C(HEAD) on the URI to which it is being redirected. type: str version_added: '2.4' version_added_collection: ansible.builtin force_basic_auth: default: false description: - By default the authentication information is only sent 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 the initial request. type: bool version_added: '2.5' version_added_collection: ansible.builtin maximum_redirection: default: 50 description: - Specifies how many times C(win_uri) redirects a connection to an alternate Uniform Resource Identifier (URI) before the connection fails. - If C(maximum_redirection) is set to 0 (zero) or C(follow_redirects) is set to C(none), or set to C(safe) when not doing C(GET) or C(HEAD) it prevents all redirection. type: int version_added: '2.4' version_added_collection: ansible.builtin client_cert_password: description: - The password for the client certificate (.pfx) file that is used for a secure web request. type: str version_added: '2.5' version_added_collection: ansible.builtin
content: description: The raw content of the HTTP response. returned: success and return_content is True sample: '{"foo": "bar"}' type: str content_length: description: The byte size of the response. returned: success sample: 54447 type: int elapsed: description: The number of seconds that elapsed while performing the download. returned: always sample: 23.2 type: float json: description: The json structure returned under content as a dictionary. returned: success and Content-Type is "application/json" or "application/javascript" and return_content is True sample: this-is-dependent: on the actual return content type: dict status_code: description: The HTTP Status Code of the response. returned: success sample: 200 type: int status_description: description: A summary of the status. returned: success sample: OK type: str url: description: The Target URL. returned: always sample: https://www.ansible.com type: str