Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using ansible to configure and deploy my app on several machines. The only problem I have now is that I am not sure how to properly initialize/automate the very first connection to this machines?

I am getting completely empty machine, so I have to put on this machine at least my public key into authorized_keys, git into known_hosts, as well as private_key for git user(I am using bitbucket). Currently I run small ansible task for every new machine to do all this things.

But I suppose there is more optimal way to do things?

Probably the only solution I see now is to setup single machine and then 'clone' it(I am using digital ocean). But this won't work for env where I am unable to clone images.

share|improve this question

I do create the public and private keys on the machine from where Ansible is run. I've got a special init playbook which connects to the servers via password and puts the key files in place. I also found a way for adding the public keys among each other to the authorized_keys file.

The source can be found here: soupdiver/ansible-cluster

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.