Playbook Deploy Error

When I run: ansible-playbook -i hosts/<environment> server.yml I get the following error:

> fatal: [45.55.27.4] => SSH Error: Permission denied (publickey,password).
>     while connecting to 45.55.27.4:22
> It is sometimes useful to re-run the command using -vvvv, which prints SSH debug output to help diagnose the issue.

> TASK: [common | Update Apt] *************************************************** 
> FATAL: no hosts matched or all hosts have already failed -- aborting


> PLAY RECAP ******************************************************************** 
>            to retry, use: --limit @/Users/Mason/server.retry

> 45.55.27.4                 : ok=0    changed=0    unreachable=1    failed=0   

I found this similar thread, and went through every step to make sure I wasn’t missing anything.

Here’s my repo for the project.

A few key points:

  • I’m on OSX
  • My subtree is set to site
  • I’m on July 17, 2015’s version or Trellis
  • My ssh key is passphrase-less
  • I can authenticate my github public key running ssh -T git@github.com

Any help would be madly appreciated. Let me know if I can supply anymore useful info. Thanks!

The deploy command is unable to connect to your server. Check that you are able to manually connect to your server by using ssh root@45.55.27.4 (I assumed because of the IP that you are deploying to Digital Ocean). If you can’t connect, or it asks you a password, it means that you don’t have your public key on the server.

Again, assuming you are on mac / linux, the easiest way to copy your public key to the server will be using ssh-copy-id (if you don’t have it installed, use homebrew or your preferred package manager to install it. After that, run ssh-copy-id root@ 45.55.27.4. It will prompt you for your password.

After you are done, validate that you can connect to the server “passwordless” using ssh root@45.55.27.4. You can then try to run the playbook again.

3 Likes

I set my SSH key as passphrase-less, so once I ran ssh-copy-id root@45.55.27.4 I got confused why it was asking for a password.

So I re-spun the droplet, generated a new key, and tried again– this time with a passphrase. It worked.

Strangely enough, my passphrase wasn’t working when I ran: ssh root@[ip-address]. But when I ran ssh [ip-address] my passphrase worked and I was able to login as the root user. I think it probably has something to do with my user permissions. :confused:

Nonetheless, the deploy worked so thank you very much for the help.