curl works but uri module times out.

2,000 views
Skip to first unread message

David Neudorfer

unread,
Oct 2, 2014, 2:57:32 PM10/2/14
to ansible...@googlegroups.com
curl returns a 200 instantly

$ curl -I -u warby-mgmt:warby-mgmt-password http://localhost:15672/api/queues/%2F/cep.transactional_email
HTTP
/1.1 200 OK
Server: MochiWeb/1.1 WebMachine/1.10.0 (never breaks eye contact)
Date: Thu, 02 Oct 2014 16:51:12 GMT
Content-Type: application/json
Content-Length: 1537
Cache-Control: no-cache


When I attempt to use the uri module it times out.


- name: Add CEP Rabbit Queues with uri module
  hosts: localhost
  gather_facts: no
  tasks:
    - name: add cep rabbit queues
      uri:
        url=http://{{ hostvars[groups['rabbit'][0]].private_ip_address }}:15672/api/queues/%2F/{{ item }}
        method=PUT
        user={{ rabbit_configuration.mgmt_user }}
        password={{ rabbit_configuration.mgmt_user }}
        body='{"type":"direct","auto_delete":false,"durable":true,"arguments":[]}'
        status_code=200
        HEADER_Content-Type="application/json"
        return_content=yes
      with_items:
        - cep.transactional_email
        - cep.transaction_test



TASK: [add cep rabbit queues] *************************************************

<10.210.3.38> ESTABLISH CONNECTION FOR USER: mozart

<10.210.3.38> REMOTE_MODULE uri url=http://localhost:15672/api/queues/%2F/cep.transactional_email method=PUT user=warby-mgmt password=VALUE_HIDDEN body='{"type":"direct","auto_delete":false,"durable":true,"arguments":[]}' status_code=200 HEADER_Content-Type="application/json"

<10.210.3.38> EXEC ['ssh', '-C', '-vvv', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=180s', '-o', 'ConnectionAttempts=60', '-o', 'ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'StrictHostKeyChecking=no', '-o', 'Port=22', '-o', 'IdentityFile=/root/.ssh/keys/dev', '-o', 'KbdInteractiveAuthentication=no', '-o', 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey', '-o', 'PasswordAuthentication=no', '-o', 'User=mozart', '-o', 'ConnectTimeout=10', u'10.210.3.38', u"/bin/sh -c 'LC_CTYPE=en_US.UTF-8 LANG=en_US.UTF-8 /usr/bin/python'"]

failed
: [d-rabbit01] => (item=cep.transactional_email) => {"failed": true, "item": "cep.transactional_email"}

msg
: Socket error: timed out to http://localhost:15672/api/queues/%2F/cep.transactional_email


Any ideas why curl works and uri fails? 


Michael DeHaan

unread,
Oct 2, 2014, 4:58:59 PM10/2/14
to ansible...@googlegroups.com
Hmm, I can't.

Perhaps usage of something like Charles Proxy (or other free methods) could be used to see whether the network activity was the same.



--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/faacb46d-505c-4bc1-b5b7-9bb31dc94ee1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Romeo Theriault

unread,
Oct 2, 2014, 4:59:05 PM10/2/14
to ansible...@googlegroups.com
On Thu, Oct 2, 2014 at 8:57 AM, David Neudorfer <david.n...@warbyparker.com> wrote:

Any ideas why curl works and uri fails?


Not sure, but a few things I noticed/might try:

* Looks like you're doing a GET with curl and a PUT with uri.

* The error you're getting "Socket error: timed out" sounds like it's unable to even connect to the port, like the port is closed or something. We know it's not though, so maybe try changing 'localhost' to an ip-address the box has to try another route to the listening port....


--
Romeo
Reply all
Reply to author
Forward
0 new messages