ssh-copy on new multiple hosts

352 views
Skip to first unread message

mark funcion

unread,
Aug 30, 2017, 12:40:02 PM8/30/17
to Ansible Project
Hi guys/gals,

Any way I can do ssh-copy on multiple hosts via Ansible ad-hoc? I have already added around 50 new hosts in the ansible_hosts inventory file but hit a wall in copying ssh to those new hosts.

pixel fairy

unread,
Aug 31, 2017, 12:52:36 AM8/31/17
to Ansible Project
do you mean your ssh key?



you could do something like

ansible all -m authorizied_key -a "user=mark key=`cat ~/.ssh/id_xor.pub`"

Dick Visser

unread,
Sep 1, 2017, 5:23:22 PM9/1/17
to ansible...@googlegroups.com
I suppose you mean "ssh-copy-id" to put your pubkey on the ~50 new
hosts that don't have it yet.
What do you mean by "hitting a wall"?
Is it host keys that aren't known yet? Then disable that:
http://docs.ansible.com/ansible/latest/intro_configuration.html#host-key-checking

Or is it something else?


Dick



--
Dick Visser
GÉANT

Want to join us? We're hiring: https://www.geant.org/jobs

mark funcion

unread,
Sep 2, 2017, 2:51:36 AM9/2/17
to Ansible Project
Sorry for the confusion. Yes, i mean "ssh-copy-id" and hoping to send my pubkey on the new 50 hosts via ad-hoc ansible.

I already tried disabling host_key_checking in the config file but no luck. I guess our machines would require ssh keys and the only option for me is to send it to thise machines

Any other ways you can suggest sending those pubkeys in a single go?

Dick Visser

unread,
Sep 2, 2017, 5:07:01 AM9/2/17
to ansible...@googlegroups.com
Well if the machines require pubkey authentication (i.e. password authentication not allowed), then you're stuck as there would be no way to authenticate at all. 
Is that the case?
If so you have a bootstrap issue aka chicken and egg problem, and need to provision the keys through other means (as ansible requires SSH).



Dick

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/9ff62f1c-42ff-47df-9f6a-229d5a4353d7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages