Hi,

*ssh-keygen* creates the public and private keys.* ssh-copy-id* copies the 
local-host’s public key to the remote-host’s authorized_keys file. 
ssh-copy-id also assigns proper permission to the remote-host’s home, 
~/.ssh, and ~/.ssh/authorized_keys.

Check host entry in /etc/host file
127.0.0.1 localhost

Check command# ansible localhost -m ping -vv

Thanks.

On Tuesday, October 9, 2018 at 6:52:49 AM UTC+5:30, Fabio Gomes Sakiyama 
wrote:
>
> Hello guys,
>
> I'm trying to use the ansible_authorized keys to create VMs (with packer 
> and terraform), adding my workspace key to VMs authorized keys.
> I think it worked because if I execute ''ssh root@myVM", it connects 
> without asking password.
>
> But when I execute "ansible all -m ping -u root" to that same host, it 
> fails with the error "sshh fails to connect to host via ssh. Permission 
> denied".
>
> I'm really confused and struggling to understand that, since a raw ssh 
> works and the ansible ssh doesn't.
>
> What am I missing??
>
> Thanks in advance!
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/054b14d1-0b65-4abd-8fa7-442023325e1b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to