Ansible OS X Mavericks You Must Install the sshpass Program

Sunday, February 9, 2014

The steps in this post are no longer necessary if you are running Ansible 1.9.2 or newer. An earlier version of Ansible probably fixed this issue, but I don’t know exactly which version.

I received the following error while bootstraping a new Rackspace Public Cloud Server with Ansible 1.4.4 on OS X Mavericks when running ansible-playbook bootstrap.yml --user root --ask-pass:

[11:48:04][user@host][playbooks] ansible-playbook bootstrap.yml --user root --ask-pass
SSH password: 

PLAY [newservers] ************************************************************* 

GATHERING FACTS *************************************************************** 
fatal: [] => to use the 'ssh' connection type with passwords, you must install the sshpass program

Ansible uses the sshpass program when logging into a server via SSH using a password. Apparently, Apple removed the sshpass program and merged its functionality into the ssh, scp, and ssh-add programs.

For security reasons, you should have Ansible logging into servers using SSH keys, but for new servers it is simpler to initially login with a password, have Ansible setup your users and SSH keys, then have subsequent logins use SSH keys.

To get past the sshpass error, you can install sshpass from source code with the following steps:

1) Install Xcode from the App Store.

2) Once Xcode is installed, download and install the Command Line Tools by opening Xcode > opening Xcode’s Preferences > clicking the Downloads tab > clicking Command Line Tools > and finally clicking the Install button.

3) Once the Command Line Tools are installed, download and un-tar the sshpass source code:

cd ~/Downloads

curl -O -L

tar xvzf sshpass-1.05.tar.gz

cd sshpass-1.05

4) Configure, make, and install the sshpass binary:



sudo make install

Now, re-running ansible-playbook bootstrap.yml --user root --ask-pass will work without problem.

comments powered by Disqus