Msg" failed to connect host via ssh" in ansible

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"


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

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