Ping Ansible module not working

Hi,

I have done generating ssh key on the ansible host and copied it into app servers. But ping does not work. Please see below screenshot.

These are the steps that I have done:

ssh-keygen -t rsa
ssh [email protected] mkdir -p .ssh
cat /home/thor/.ssh/id_rsa.pub | ssh [email protected] ‘cat >> .ssh/authorized_keys’
ssh [email protected] “chmod 700 .ssh; chmod 640 .ssh/authroized_keys”
ssh [email protected]

Iam successful upto doing ssh without password. But the command

ansible -m ping stapp01 does not work, how do I use that inventory file to make the
ping work. Please help.

Just cd to your inventory file dir and use “ansible stapp01 -m ping -i inventory” command as shown below

[email protected]_host /$ cd /home/thor/ansible/
[email protected]_host ~/ansible$ ansible stapp01 -m ping -i inventory
stapp01 | SUCCESS => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python"
    },
    "changed": false,
    "ping": "pong"
}
[email protected]_host ~/ansible$