Team, team not able to connect to ansible remote machines with inventory file en . . .

E babu:
team, team not able to connect to ansible remote machines with inventory file entry as ssh_pass

Al West:
Where are you passing your password? You can do it in the inventory:

---
all:
  hosts:
    tiny:
    pi4:
      ansible_user: "al"
      ansible_password: "password"

Check connectivity with ansible ping:

ansible -m ping all -i hosts.yaml

Al West:
should get the following output:

tiny | SUCCESS => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python3"
    },
    "changed": false,
    "ping": "pong"
}
pi4 | SUCCESS => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python3"
    },
    "changed": false,
    "ping": "pong"
}

Prince Sarvaiya:
Hi @E babu,

If we fail to add the host fingerprint in known hosts, we can encounter this.

You can login to server from the controller, so it gets added in know host.

You can edit
> /etc/ansible/ansible.cfg/
and uncomment
> host key checking = False

E babu:
thank you, i will try. but i,m able to connect to the remote host with adding pem file path in inventory

E babu:
@Al West @Prince Sarvaiya i’m getting this error when try with password option in inventory ansibleclient | UNREACHABLE! => {
“changed”: false,
“msg”: “Failed to connect to the host via ssh: [email protected]: Permission denied (publickey).”,
“unreachable”: true
}

E babu:
@Prince Sarvaiya; tried that option getting “msg”: “Failed to connect to the host via ssh: [email protected]: Permission denied (publickey).”,

E babu:
could you please suggest

Al West:
either you are using the wrong ssh public key to access the server, or you are using the wrong user.

E babu:
actually when i ssh with -i and pem file of target server i was able to ssh but not able to ssh the target machine with ssh_password option with inventory file

Al West:
please paste your inventory file - edit the password to <password> or something