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

NameTypeRequiredDefaultDescription
urlstringyesHTTP or HTTPS URL
methodstringGETThe HTTP method of the request
bodyrawThe body of the HTTP request. A mapping or list is serialised according to body_format
body_formatstringrawThe serialisation applied to body (raw, json, form-urlencoded)
headersdictHTTP headers to send with the request
status_codelist[200]A list of valid, numeric, HTTP status codes that signifies success
timeoutint30The amount of time in seconds to wait for the request
follow_redirectsstringsafeWhether redirects should be followed (all, none, safe)
validate_certsbooltrueIf false, TLS certificates will not be validated
return_contentboolfalseWhether to return the body of the response as the content key
deststringPath on the target to write the response body to
createsstringA path; if it already exists the request is not made
removesstringA path; if it does not exist the request is not made
url_usernamestringThe username for HTTP authentication
url_passwordstringThe password for HTTP authentication
force_basic_authboolfalseSend the basic authentication header without waiting for a 401 challenge
client_certstringPEM formatted certificate chain file used for TLS client authentication
client_keystringPEM formatted private key file used for TLS client authentication
ca_pathstringPEM formatted file of trusted CA certificates to verify the server against
http_agentstringansible-httpgetThe User-Agent header to send
use_proxybooltrueIf false, the environment’s proxy settings are ignored
unix_socketstringPath 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