ansible connection using rsa key

107 views
Skip to first unread message

SUMIT SAHAY

unread,
Sep 14, 2018, 2:53:00 AM9/14/18
to Ansible Project
Hi All,

I want to know is there any way to get connect to the remote host with ansible control server using rsa key.

Instead of using user name and password I want to use rsa key for authentication.

How can we do that?

Looking forward for reply.

Thanks & Regards
Sumit Sahay

cavamagie

unread,
Sep 14, 2018, 2:58:21 AM9/14/18
to ansible...@googlegroups.com
Likes this?
ansible-playbook -i hosts playbook.yml --key-file "~/.ssh/mykey.pem"

See in 


--
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/d8819b40-3681-4a96-af56-aab0821fa758%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

SUMIT SAHAY

unread,
Sep 14, 2018, 3:05:39 AM9/14/18
to Ansible Project
Hi Cava,

Thanks for your reply.

While doing this, we don't need to enter user credential in host file?
Is it so?

Looking for your reply.

Regards
Sumit Sahay

cavamagie

unread,
Sep 14, 2018, 3:38:06 AM9/14/18
to ansible...@googlegroups.com
hi only the first time you have to copy the public key and insert the pwd

for example with 
cat ~/.ssh/id_rsa.pub | ssh user@hostname 'cat >> .ssh/authorized_keys'

or 

ssh-copy-id -i ~/.ssh/mykey user@host

after when the key i present over the host
you can cannect without any password




Reply all
Reply to author
Forward
0 new messages