I recently rented a Linux box and I intend to provision it using Ansible. I'd like to use Ansible as early as possible in the process. At this stage I only have a root account and the corresponding password.
- Given the fact that my target box as well as OpenSSH-Server is running, would it be possible to copy my public key to the server and configure it with Ansible at this early stage?
- Do I have to manually copy the pub key to the server and configure ssh for Ansible to be able to communicate with the server in the first place?
I should've mentioned, that after reading the docs I used the following syntax:
ansible <nameoftargetbox> -m ping -u root -k
The command basically means use user root ( -u ) and ask for password ( -k ). I am correctly prompted for the password, but I keep getting this response:
<nameoftargetbox>| FAILED => to use -c ssh with passwords, you must install the sshpass program
Needless to say that a common
ssh root@<targetbox> works flawlessly.
After researching some more I found a solution in the Ansible github issue tracker. I'll post it as an answer to this question.