On Sun, 15 Mar 2020 19:27:51 -0700 (PDT)
Pravin Patil <[email protected]> wrote:

> I am able to ssh from Ansible Control Machine to Target node if I manually 
> type the SSH commands
> [email protected]:~/ansible$ ssh [email protected]
> 
> [email protected]:~/ansible$ ansible -i hosts -m ping all -vvv
> [...]
> <1.1.1.1> ESTABLISH SSH CONNECTION FOR USER: ubuntu
> [...]
> <1.1.1.1> (255, '', '[email protected]: Permission denied (publickey).\r\n')
> 1.1.1.1 | UNREACHABLE! => {
> 
>     "changed": false, 
> 
>     "msg": "Failed to connect to the host via ssh: [email protected]: 
> Permission denied (publickey).\r\n", 

You're able to connect to "[email protected]". The same "REMOTE_USER" must be
specified in Ansible. For example

  $ ansible -i hosts -m ping -vvv -u ec2-user all

See

"Hosts and Users" (remote_user)
https://docs.ansible.com/ansible/latest/user_guide/playbooks_intro.html#hosts-and-users

"Adding variables to inventory" (ansible_user)
https://docs.ansible.com/ansible/latest/user_guide/intro_inventory.html#adding-variables-to-inventory

"Ansible remote_user vs ansible_user"
https://stackoverflow.com/questions/36668756/ansible-remote-user-vs-ansible-user

HTH,

        -vlado

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/20200316035306.520dbf41%40gmail.com.

Attachment: pgp_rgBdDzGrQ.pgp
Description: OpenPGP digital signature

Reply via email to