Using Ansible to provision simple Rails server

February 23, 2014 3.6k views
Hey, I am trying to use Ansible to provision a simple Rails server with nginx, passenger, rails and postgresql. I have copied my SSH key over to the VPS and I can see it in ~/.ssh/authorized_keys but when I navigate to the directory on my local machine where I have my Ansible setup and playbooks and run ansible all -i hosts -m ping I get: | FAILED => SSH encountered an unknown error during the connection. We recommend you re-run the command using -vvvv, which will enable SSH debugging output to help diagnose the issue I rerun with -vvvv and get a huge amount of debug info. I'm not quite sure which part to post here so this is a bit I feel is the most important: debug2: kex_derive_keys debug2: set_newkeys: mode 1 debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug2: set_newkeys: mode 0 debug1: SSH2_MSG_NEWKEYS received debug1: Roaming not allowed by server debug1: SSH2_MSG_SERVICE_REQUEST sent debug2: service_accept: ssh-userauth debug1: SSH2_MSG_SERVICE_ACCEPT received debug2: key: /Users//.ssh/id_rsa (0x7f8253000360), debug2: key: /Users//.ssh/id_dsa (0x0), debug1: Authentications that can continue: publickey,password debug3: start over, passed a different list publickey,password debug3: preferred gssapi-with-mic,gssapi-keyex,hostbased,publickey debug3: authmethod_lookup publickey debug3: remaining preferred: ,gssapi-keyex,hostbased,publickey debug3: authmethod_is_enabled publickey debug1: Next authentication method: publickey debug1: Offering RSA public key: /Users//.ssh/id_rsa debug3: send_pubkey_test debug2: we sent a publickey packet, wait for reply debug1: Authentications that can continue: publickey,password debug1: Trying private key: /Users//.ssh/id_dsa debug3: no such identity: /Users//.ssh/id_dsa: No such file or directory debug2: we did not send a packet, disable method debug1: No more authentication methods to try. Permission denied (publickey,password). Any ideas on how I can solve this? Kind regards, Neil
1 Answer
Did you copy over the public key or the private key?

We've got a tutorial for setting up Ansible, including ssh keys:

That should point you in the right direction. Let us know if you're still having issues!

by Justin Ellingwood
Configuration management is an administrative concept that deals with managing multiple remote machines from a single server in an automated way. Ansible is a simple, but powerful configuration management system that communicates with and configures remote systems through simple SSH connections. In this guide, we will discuss how to install and configure an Ansible server that we can later use to control our hosts
Have another answer? Share your knowledge.