Do you have ‘localhost’ defined in your inventory? If so, have you specified ansible_python_interpreter=/usr/local/bin/python along with it in your inventory?
You do mention that /usr/bin/python has access to httplib2, but that could be due to something such as setting PYTHONPATH somewhere that would allow /usr/bin/python to load httplib2 that it wouldn’t otherwise have access to, and as a result ansible is running without access to PYTHONPATH maybe…
The code that determines if you have httplib2 is somewhat simple:
I’ve often found that using python from homebrew causes more problems than it solves.
You can probably do something like:
sudo PYTHONPATH=“” /usr/bin/easy_install httplib2
On Mac, usually one of the first things I do is:
sudo /usr/bin/easy_install pip
Unfortunately that will try to squash pip provided by homebrew installed python as they both use /usr/local/bin/pip as their destination.
If you want to use python from homebrew, then your inventory modification is probably the right change to make.
Either that , or don’t target localhost explicitly, remove localhost from your inventory and use local_action or delegate_to: localhost, which does some magic (implicit localhost) and uses the python binary used to invoke ansible as ansible_python_interpreter.