title: Ansible URI module with cacert option
body: <p>I'm trying to do the equivalent of:</p>
  
  <p><code>curl -X POST --data &lt;json&gt; --key &lt;path to key&gt; --cert &lt;path to cert&gt; --cacert &lt;path to cacert&gt; --header "Content-Type: application/json" &lt;url&gt;</code></p>
  
  <p>in an ansible play. Following the documentation from <a href="http://docs.ansible.com/ansible/latest/uri_module.html" rel="noreferrer">http://docs.ansible.com/ansible/latest/uri_module.html</a>, there are equivalents for key, cert, X, header, and data, but I haven't found a way to pass in a Certificate Authority file.</p>
  
  <p>I've tried:</p>
  
  <pre><code>environment:
    CURL_CA_BUNDLE: &lt;path to cacert&gt;
  uri:
    url: &lt;url&gt;
    client_cert: &lt;path to cert&gt;
    client_key: &lt;path to key&gt;
    body: &lt;json&gt;
    method: POST
    body_format: json
  </code></pre>
  
  <p>Since man curl specifies that it will read the environment variable <code>CURL_CA_BUNDLE</code>. I have also tried:</p>
  
  <pre><code>uri:
    url: &lt;url&gt;
    client_cert: &lt;path to cert&gt;
    client_key: &lt;path to key&gt;
    body: &lt;json&gt;
    method: POST
    body_format: json
    others: --cacert &lt;path to cacert&gt;
  </code></pre>
  
  <p>Neither method has worked. Without the cacert, I am getting the error: "Failed to validate the SSL certificate for <code>&lt;url&gt;</code>. Make sure your managed systems have a valid CA certificate installed...". I know that if I pass in <code>validate_certs=False</code>, then the method will work, and I know that it works via command line with curl.</p>
  
  <p>Is there another option I can pass into the URI module to bypass this issue?</p>