ansible / ansible.builtin / v2.3.0.0-1 / module / win_uri Interacts with webservices. | "added in version" 2.1 of ansible.builtin" Authors: Corwin Brown (@blakfeld) preview | supported by communityansible.builtin.win_uri (v2.3.0.0-1) — module
pip
Install with pip install ansible==2.3.0.0.post1
Interacts with HTTP and HTTPS web services and supports Digest, Basic and WSSE HTTP authentication mechanisms.
- 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: - HTTP or HTTPS URL in the form of (http|https)://host.domain:port/path required: true body: description: - The body of the HTTP request/response to the web service. dest: description: - Output the response body to a file. version_added: '2.3' version_added_collection: ansible.builtin method: choices: - GET - POST - PUT - HEAD - DELETE - OPTIONS - PATCH - TRACE - CONNECT - REFRESH default: GET description: - The HTTP Method of the request or response. headers: description: - 'Key Value pairs for headers. Example "Host: www.somesite.com"' content_type: description: - Sets the "Content-Type" header. use_basic_parsing: choices: - true - false default: true description: - This module relies upon 'Invoke-WebRequest', which by default uses the Internet Explorer Engine to parse a webpage. There's an edge-case where if a user hasn't run IE before, this will fail. The only advantage to using the Internet Explorer praser is that you can traverse the DOM in a powershell script. That isn't useful for Ansible, so by default we toggle 'UseBasicParsing'. However, you can toggle that off here.
body: description: The content of the body used returned: when body is specified sample: '{"id":1}' type: string version_added: '2.3' version_added_collection: ansible.builtin content_type: description: The "content-type" header used. returned: always sample: application/json type: string headers: description: The Headers of the response. returned: success sample: Content-Type: application/json type: dict method: description: The HTTP method used. returned: always sample: GET type: string raw_content: description: The raw content of the HTTP response. returned: success sample: 'HTTP/1.1 200 OK\nX-XSS-Protection: 1; mode=block\nX-Frame-Options: SAMEORIGIN\nAlternate-Protocol: 443:quic,p=1\nAlt-Svc: quic="www.google.com:443"; ma=2592000; v="30,29,28,27,26,25",quic=":443"; ma=2...' type: string raw_content_length: description: The byte size of the response. returned: success sample: 54447 type: int status_code: description: The HTTP Status Code of the response. returned: success sample: 200 type: int status_description: description: A summery of the status. returned: success sample: OK type: string url: description: The Target URL returned: always sample: https://www.ansible.com type: string use_basic_parsing: description: The state of the "use_basic_parsing" flag. returned: always sample: true type: bool