How to install Python packages to (Homebrew) Ansible's site-packages folder
Solution 1:
By default, Ansible will use the Python install at /usr/bin/python
unless you tell it otherwise. If you want it to use Homebrew Python, just add this to your inventory file:
[local]
localhost ansible_python_interpreter=/usr/local/bin/python
Solution 2:
If you need to use a package on the OSX control machine you will need to run these two lines after brew install ansible
mkdir -p ~/Library/Python/2.7/lib/python/site-packages
echo '/usr/local/lib/python2.7/site-packages' > ~/Library/Python/2.7/lib/python/site-packages/homebrew.pth
https://github.com/Homebrew/homebrew/issues/29079
I needed this on my control machine to encrypt prompted variables using Passlib