Install sshpass program on MacOS

Install sshpass program on MacOS

I've recently hit an issue where I was receiving the following error when running some of my ansible scripts:

FAILED! => {"msg": "to use the 'ssh' connection type with passwords or pkcs11_provider, you must install the sshpass program"}

There are two workarounds for this.

Use the configurations in your ansible.cfg

Add the following line in your ansible.cfg file


There are several places where this file could sit. I typically put mine in the root of the project directory

Install the sshpass program

It's relatively easy to install it on Ubuntu. To do so, you simply have to run:

sudo apt install sshpass

There is a bit more controversy with this with MacOS. I installed mine using the no longer maintained homebrew tap

brew install hudochenkov/sshpass/sshpass

There are a number of other libraries that have since sprung but I have not tested them out yet

Here's a thread on Stack Overflow that discusses this specific topic