I am trying to use the get_url module for ansible and when I run it I get the following error:
failed: [localhost] => (item=10) => {"failed": true, "item": "10"}
msg: httplib2 is not installed
Now I have successfully installed httplib2 using pip:
pip install httplib2
Requirement already satisfied (use --upgrade to upgrade): httplib2 in /usr/local/lib/python2.7/site-packages
But obviously that hasn't helped the situation. I can see that ansible is using a different PYTHON_PATH than the OS (where httplib2 is installed) but I cannot work out how to get a httplib2 installed into that path (other than copying it which isn't nice).
Any help greatly appreciate.
If this is an ansible-playbook error, you can run a pip command to install the httplib2 artifact. Try running the following task before:
tasks:
- name: pip httplib2
# ansible uri module requires httplib2
pip: name=httplib2 extra_args="--user"
I ran into this problem on one of my Macs (I had been switching between a Homebrew Python installation and the system install recently, so something was funky anyways), and what ended up fixing it, at least for a particular session, was starting an interactive python session on the CLI and importing the library:
$ python
>>> import httplib2
>>> exit()
$ [continue what you were doing with ansible...]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With