Msg" failed to connect host via ssh" in ansible


#1

i have configured ansbile on ubuntu machine and 2 vms are as clients
when i ran the command "ansible -m ping web-ervers

it throws an error

msg" failed to connect host via ssh"


#2

Hi

Please try to use root user user following:
ansible -m ping web-servers -u root
ansible -m ping web-servers -s

Please reply if it works


#3

You need to have a user account that is used on all systems, root can be used and the password is the same.

Then, you need to transfer an ssh key with that account to all systems using ssh-copy-id.

It should work after that