ticated request, and when the server replies
        with an C(HTTP 401) error, it will submit the Basic authentication header.
      - When this setting is C(true), this module will immediately send a Basic authentication header on the first
        request.
      - "Use this setting in any of the following scenarios:"
      - You know the webservice endpoint always requires HTTP Basic authentication, and you want to speed up your
        requests by eliminating the first roundtrip.
      - The web service does not properly send an HTTP 401 error to your client, so Ansible's HTTP library will not
        properly respond with HTTP credentials, and logins will fail.
      - The webservice bans or rate-limits clients that cause any HTTP 401 errors.
    type: bool
    default: no
  follow_redirects:
    description:
      - Whether or not the URI module should follow redirects.
      - V(all) Will follow all redirects.
      - V(none) Will not follow any redirects.
      - V(safe) Only redirects doing GET or HEAD requests will be followed.
      - V(urllib2) Defer to urllib2 behavior (As of writing this follows HTTP redirects).
      - V('no') (DEPRECATED, will be removed in the future version) alias of V(none).
      - V('yes') (DEPRECATED, will be removed in the future version) alias of V(all).
    choices: ['all', 'none', 'safe', 'urllib2', 'yes', 'no']
    type: str
    default: safe
  creates:
    description:
      - A filename, when it already exists, this step will not be run.
    type: path
  removes:
    description:
      - A filename, when it does not exist, this step will not be run.
    type: path
  status_code:
    description:
      - A list of valid, numeric, HTTP status codes that signifies success of the request.
    type: list
    elements: int
    default: [ 200 ]
  timeout:
    description:
      - The socket level timeout in seconds
    type: int
    default: 30
  headers:
    description:
        - Add custom HTTP headers to a request in the format of a YAML hash. As
          of C(2.3) supplying C(Content-Type) here will override the header
          generated by supplying C(json) or C(form-urlencoded) for I(body_format).
    type: dict
    default: {}
    version_added: '2.1'
  validate_certs:
    description:
      - If C(false), SSL certificates will not be validated.
      - This should only set to C(false) used on personally controlled sites using self-signed certificates.
      - Prior to 1.9.2 the code defaulted to C(false).
    type: bool
    default: true
    version_added: '1.9.2'
  client_cert:
    description:
      - 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, I(client_key) is not required
    type: path
    version_added: '2.4'
  client_key:
    description:
      - PEM formatted file that contains your private key to be used for SSL client authentication.
      - If I(client_cert) contains both the certificate and key, this option is not required.
    type: path
    version_added: '2.4'
  ca_path:
    description:
      - PEM formatted file that contains a CA certificate to be used for validation
    type: path
    version_added: '2.11'
  src:
    description:
      - Path to file to be submitted to the remote server.
      - Cannot be used with I(body).
      - Should be used with I(force_basic_auth) to ensure success when the remote end sends a 401.
    type: path
    version_added: '2.7'
  remote_src:
    description:
      - If C(false), the module will search for the C(src) on the controller node.
      - If C(true), the module will search for the C(src) on the managed (remote) node.
    type: bool
    default: no
    version_added: '2.7'
  force:
    description:
      - If C(true) do not get a cached copy.
    type: bool
    default: no
  use_proxy:
    description:
      - If C(false), it will not use a proxy, even if one is defined in an environment variable on the target hosts.
    type: bool
    default: true
  unix_socket:
    description:
    - Path to Unix domain socket to use for connection
    type: path
    version_added: '2.8'
  http_agent:
    description:
      - Header to identify as, generally appears in web server logs.
    type: str
    default: ansible-httpget
  unredirected_headers:
    description:
      - A list of header names that will not be sent on subsequent redirected requests. This list is case
        insensitive. By default all headers will be redirected. In some cases it may be beneficial to list
        headers such as C(Authorization) here to avoid potential credential exposure.
    default: []
    type: list
    elements: str
    version_added: '2.12'
  use_gssapi:
    description:
      - Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate
        authentication.
      - Requires the Python library L(gssapi,https://github.com/pythongssapi/python-gssapi) to be installed.
      - Credentials for GSSAPI can be specified with I(url_username)/I(url_password) or with the GSSAPI env var
        C(KRB5CCNAME) that specified a custom Kerberos credential cache.
      - NTLM authentication is C(not) supported even if the GSSAPI mech for NTLM has been installed.
    type: bool
    default: no
    version_added: '2.11'
  use_netrc:
    description:
      - Determining whether to use credentials from ``~/.netrc`` file
      - By default .netrc is used with Basic authentication headers
      - When set to False, .netrc credentials are ignored
    type: bool
    default: true
    version_added: '2.14'
extends_documentation_fragment:
  - action_common_attributes
  - files
attributes:
    check_mode:
        support: none
    diff_mode:
        support: none
    platform:
        platforms: posix
notes:
  - The dependency on httplib2 was removed in Ansible 2.1.
  - The module returns all the HTTP headers in lower-case.
  - For Windows targets, use the M(ansible.windows.win_uri) module instead.
seealso:
- module: ansible.builtin.get_url
- module: ansible.windows.win_uri
author:
- Romeo Theriault (@romeotheriault)
a‚