Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
    
Why puppet tag? –  Mxx Apr 7 at 4:55
    
I would put chef and salt also, if there were more than 5 tags, because in general the answer will be mostly the same for all automation systems. IMHO, puppet is one of the most mature of them, so community already should have solve this problem. –  Jevgeni Smirnov Apr 7 at 5:09
1  
You are not supposed to use tags for question advertisement but rather for categorization...Additionally, in the title of your question you say Ansible, yet you say you want to know how to puppet and chef do it? –  Mxx Apr 7 at 12:01
    
You are insisting so much, so I will remove the tag. But seems you don't understand the question and the topic if you are asking such a question. –  Jevgeni Smirnov Apr 7 at 13:14

1 Answer 1

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

 
discard

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.