Cannot ping target1 VM using ansible

Hi,

I cannot ping target1 VM using ansible because of error.

After writing “ansible target1 -m ping -i inventory.txt” I am getting following response:

target1 | 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.”}

I need help ASAP.

It’s from the course " [Ansible for the Absolute Beginner - Hands-On - DevOps]" - “Section 3: Ansible Inventory” - “10. Demo - Ansible Inventory”

Thanks!

Hello @wjkszpl
Please add the below lines in /etc/ansible/ansible.cfg and check again.

[defaults]
host_key_checking = false

Hi @Ayman

File ansible.cfg is read-only, I don’t have permissions to save the file, what now?

Hello @wjkszpl
Did you try with sudo?

Hi @Ayman

I am using text editor in CentOS 7 to edit file. All permissions are with me (admin rights) in my account, but not sufficient to edit ansible.cfg

Changing rights to the file should help, what is the correct syntax to do it?