fatal: [matrix2.host.com]: UNREACHABLE! => changed=false

Error while attempting to run playbook
ansible-playbook -i inventory/hosts setup.yml --tags=setup-system-user --ask-become-pass

Looks like the above issue is that Ansible is not able to authenticate with the server. By default it looks to try and use ssh keys, but I don’t have any passwordless ssh keys set up for Ansible to use so it fails while attempting to connect. The work around it to make sure you have sshpass installed and then specify –ask-pass to the end of the command.

ansible-playbook -i inventory/hosts setup.yml --tags=setup-system-user --ask-become-pass --ask-pass

When the command runs it’ll ask you for the ssh password and then use that.

Installing sshpass on OS X

Note: To install sshpass you need to make sure you have Xcode installed along with the Xcode command line tools.  You can download Xcode from the app store, and then install the command line tools from Xcode’s Preferences.

Now open up your terminal and run the following commands.

Download sshpass from source forge.

curl -O -L http://downloads.sourceforge.net/project/sshpass/sshpass/1.05/sshpass-1.05.tar.gz

Extract the tarball and cd into the directory.

tar zxvf sshpass-1.05.tar.gz && cd sshpass-1.05

make and install.

./configure
make
sudo make install

Now test and make sure it works

sshpass -V

You should receive the following.

sshpass 1.05 (C) 2006-2011 Lingnu Open Source Consulting Ltd.
This program is free software, and can be distributed under the terms of the GPL
See the COPYING file for more information.