I have been trying to connect to machines and run a ping command on nodes using ansible. I am getting the below message.
ansible -i inventory all -m ping
Error Message:
centosinstance | UNREACHABLE! => {
    "changed": false, 
    "msg": "Failed to connect to the host via ssh: ssh: Could not resolve hostname centosinstance: Name or service not known\r\n", 
    "unreachable": true
}
I have also stated the private key file and the remote user name in ansible.cfg file.
Can anyone help me with this issue ?