Ansible Error: Host Key checking is enabled and sshpass does not support this

Error

root@DESKTOP-94AUF6U:~# ansible all -i 18.208.198.47,172.22.240.232, -m apt -a"name=apache2 state=present" -u ubuntu -k -b
SSH password:
172.22.240.232 | FAILED! => {
    "msg": "Using a SSH password instead of a key is not possible because Host Key checking is enabled and sshpass does not support this.  Please add this host's fingerprint to your known_hosts file to manage this host."
}
18.208.198.47 | FAILED! => {
    "msg": "Using a SSH password instead of a key is not possible because Host Key checking is enabled and sshpass does not support this.  Please add this host's fingerprint to your known_hosts file to manage this host."

Solution

Step - 1
Run following commands in each ARS
$ apt update
$ apt install sshpass

Step - 2
Modify /etc/ansible/ansible.cfg in ACS

$ vi /etc/ansible/ansible.cfg

[defaults]
host_key_checking = False

Error

root@DESKTOP-94AUF6U:~# ansible all -i 18.208.198.47,172.22.240.232, -m apt -a"name=apache2 state=present" -u ubuntu -k -b
SSH password:
172.22.240.232 | UNREACHABLE! => {
    "changed": false,
    "msg": "Failed to create temporary directory. In some cases, you may have been able to authenticate and did not have permissions on the target directory. Consider changing the remote tmp path in ansible.cfg to a path rooted in \"/tmp\", for more error information use -vvv. Failed command was: ( umask 77 && mkdir -p \"` echo /home/ubuntu/.ansible/tmp `\"&& mkdir \"` echo /home/ubuntu/.ansible/tmp/ansible-tmp-1692676517.394163-1957-255011346482889 `\" && echo ansible-tmp-1692676517.394163-1957-255011346482889=\"` echo /home/ubuntu/.ansible/tmp/ansible-tmp-1692676517.394163-1957-255011346482889 `\" ), exited with result 1",
    "unreachable": true
}
18.208.198.47 | UNREACHABLE! => {
    "changed": false,
    "msg": "Failed to connect to the host via ssh: Warning: Permanently added '18.208.198.47' (ED25519) to the list of known hosts.\r\nubuntu@18.208.198.47: Permission denied (publickey).",
    "unreachable": true
}

Answer – user’s right access is not set with their directory

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x