Shell script wget works for URL check with Http 200 OK but Ansible uri 
module failed for same URL. Please suggest the right module or options to 
use in the Ansible playbook to resolve this error.

$ wget --no-dns-cache --server-response --no-check-certificate 
http://mynode.com:8080
--2018-09-21 15:53:53--  http://mynode.com:8080/
Resolving mynode.com:8080... 10.47.40.92
Connecting to mynode.com:8080|10.47.40.92|:8801... connected.
HTTP request sent, awaiting response...
  HTTP/1.1 200 OK
  Date: Fri, 21 Sep 2018 20:53:53 GMT
  Server: Apache/2.4.7 (Unix) OpenSSL/1.0.2d
  Cache-Control: max-age=31536000
  Expires: Sat, 21 Sep 2019 20:53:53 GMT
  Vary: Accept-Encoding
  Keep-Alive: timeout=5, max=100
  Connection: Keep-Alive
  Transfer-Encoding: chunked
  Content-Type: text/html;charset=ISO-8859-1
Length: unspecified [text/html]
Saving to: 'index.html.6'

index.html.6                                           [ <=>                
                                                                            
                ]   1.78K  --.-KB/s    in 0s

2018-09-21 15:53:53 (4.48 MB/s) - 'index.html.6' saved [1821]


Ansible task fails with uri module

    - name: Check the URL status
      uri:
        body_format: raw
        url: "http://{{ item.hostname }}:{{ item.listenerport }}"
        method: GET
        validate_certs: no
        timeout: 60
                status_code: "200"
        method: GET
        headers:
          Content-Type: application/json
          Accept: application/json
              register: result      
       delegate_to: 127.0.0.1    
              ignore_errors: yes

     "msg": "Status code was -1 and not [200]: Request failed: <urlopen 
error [Errno -2] Name or service not known>",
    "redirected": false

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a3988e83-1b77-44a5-94d8-589801a80f64%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to