uri
Collection: builtin
Full Name: parallax.builtin.uri
Aliases: ansible.builtin.uri, uri
Synopsis
Make an HTTP request and check or capture the response
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| url | string | yes | HTTP or HTTPS URL | |
| method | string | GET | The HTTP method of the request | |
| body | raw | The body of the HTTP request. A mapping or list is serialised according to body_format | ||
| body_format | string | raw | The serialisation applied to body (raw, json, form-urlencoded) | |
| headers | dict | HTTP headers to send with the request | ||
| status_code | list | [200] | A list of valid, numeric, HTTP status codes that signifies success | |
| timeout | int | 30 | The amount of time in seconds to wait for the request | |
| follow_redirects | string | safe | Whether redirects should be followed (all, none, safe) | |
| validate_certs | bool | true | If false, TLS certificates will not be validated | |
| return_content | bool | false | Whether to return the body of the response as the content key | |
| dest | string | Path on the target to write the response body to | ||
| creates | string | A path; if it already exists the request is not made | ||
| removes | string | A path; if it does not exist the request is not made | ||
| url_username | string | The username for HTTP authentication | ||
| url_password | string | The password for HTTP authentication | ||
| force_basic_auth | bool | false | Send the basic authentication header without waiting for a 401 challenge | |
| client_cert | string | PEM formatted certificate chain file used for TLS client authentication | ||
| client_key | string | PEM formatted private key file used for TLS client authentication | ||
| ca_path | string | PEM formatted file of trusted CA certificates to verify the server against | ||
| http_agent | string | ansible-httpget | The User-Agent header to send | |
| use_proxy | bool | true | If false, the environment’s proxy settings are ignored | |
| unix_socket | string | Path to a Unix domain socket to make the request over |
Example
- name: Wait for the health endpoint to report ready
uri:
url: http://localhost:8080/healthz
status_code: 200
return_content: true
register: health
until: health.status == 200
retries: 12
delay: 5