httplib2 and uri

47 views
Skip to first unread message

tom rkba

unread,
Nov 4, 2015, 10:55:24 AM11/4/15
to Ansible Project
I am trying to figure out what is wrong with either my playbook, python installation or both.

Both hosts are running CentOS 6. 
Python: python.x86_64                 
                     2.6.6-52.el6
Ansible 1.9.4 is installed on the control host.

The data being returned is:

OK54Web Server is healthy2.0.5-dDatabaseHealthCheckTaskOK1Database at is healthy. RiakOK52Riak at riakhost:8087 is healthy.

I am looking for the string "Web Server is healthy"

The JSON is:

    <healthcheckresponse>
        <code>
        OK
        </code>
        <duration>
        54
        </duration>
        <message>
        Web Server is healthy
        </message>
        <version>
        2.0.5-d
        </version>
        <component_health_check>
            <name>
            DatabaseHealthCheckTask
            </name>
            <code>
            OK
            </code>
            <duration>
            1
            </duration>
            <message>
            Database at @somehost
            </message>
        </component_health_check>
        <component_health_check>
            <name>
            Riak
            </name>
            <code>
            OK
            </code>
            <duration>
            52
            </duration>
            <message>
            Riak at somehost:8087 is …
            </message>
        </component_health_check>
        <link id="lite-css-list"></link>
    </healthcheckresponse>


I have the following playbook that is intended to connect and pull some data about what the server is doing:

----
- name: healthCheck
  hosts: web
  gather_facts: no
  serial: 1
  sudo: true

  tasks:
    - action: uri url="http://localhost:8080/healthCheck" return_content=yes
      register: json_response

    - action: fail
      when:  TBD (deleted) (I haven't  figured this out but it doesn't get this far anyway;  I had some stuff off the Ansible URI page)
----

The result:

PLAY [healthCheck] *************************************************

TASK: [uri url="http://localhost:8080/healthCheck" return_content=yes] ****
failed: [somehost] => {"failed": true}
msg: httplib2 is not installed

FATAL: all hosts have already failed -- aborting

PLAY RECAP ********************************************************************
           to retry, use: --limit @/root/hc.retry

somehost : ok=0    changed=0    unreachable=0    failed=1


In reviewing the "httplib2 is not installed" message, I followed a bunch of procedures on the 'net.

1) Update rpm to version 1.9.4.
2) Review python version (see above)
3) Check for httplib2:

/usr/lib/python2.6/site-packages
$ ls -dl http*
drwxr-xr-x 2 root root 4096 Jun  3 15:46 httplib2
drwxr-xr-x 2 root root 4096 Jun  3 15:46 httplib2-0.7.7-py2.6.egg-info

The lib is present on both hosts.


1) Why is it not finding httplib2 when it's installed in /usr/lib/python2.6/site-packages?
2) How do I get Ansible to parse the output looking for "Web Server is healthy"?

Thanks!

Toshio Kuratomi

unread,
Nov 4, 2015, 8:33:57 PM11/4/15
to ansible...@googlegroups.com
I don't see anything wrong with your playbook. The error your getting
means that for some reason ansible isn't finding your httplib2
installed on the remote machine(s) (Would be multiple machines if web
is a group rather than a single host).

Judging from your description so far, do you have everything installed
from one of CentOS or EPEL repositories? On the remote machine, what
httplib2 is installed? (For instance, what does this ansible command
show: ansible web -m command -a 'rpm -q python-httplib2'

-Toshio
> --
> 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/77ec454b-3d12-4ee3-b905-157c924957d1%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages