However, in some cases, you may want to disable this check, such as when you are running Ansible playbooks against a large number of servers with changing SSH keys. To ignore SSH authenticity checking, you can use the following options:
1. Use the ansible_ssh_common_args variable in your inventory file to pass the -o StrictHostKeyChecking=no option to the SSH client:
[all:vars]
ansible_ssh_common_args='-o StrictHostKeyChecking=no'
This option disables SSH key checking for all hosts in your inventory file.
2. Use the ANSIBLE_HOST_KEY_CHECKING environment variable to disable SSH key checking globally:
export ANSIBLE_HOST_KEY_CHECKING=False
This option disables SSH key checking for all Ansible commands.
Note that disabling SSH key checking can make your system vulnerable to man-in-the-middle attacks. Therefore, it is recommended to use this option only in situations where you fully trust the remote servers and have no other option.
Comments (0)