Ansible disable host key checking – How we troubleshoot it
Are you stuck with Ansible disable host key checking? We can help you with it.
For a wide variety of automation challenges, ansible provides large productivity gain
At Bobcares, we often receive requests to disable it as part of our Server Management Services.
Today, let’s discuss how our Support Engineers easily disable it for our customers.
Why ansible disable host key checking?
Before getting into the topic, let’s first discuss the importance of ansible.
At the beginning of network computing, managing servers efficiently was a major challenge.
As hosted applications get more complex, server administrators find it difficult to manage servers, software installations, configurations and so on.
And, Ansible is a server provisioning and configuration management tool that made the Server administrators task easier.
Ansible can work against multiple hosts in the infrastructure at the same time. To do so, it uses a list or group of lists known as inventory.
But, sometimes we need to disable the host key checking and it often appears as a confusing task.
How we disable host key checking?
Recently, one of our customers approached us with an ansible error. He tried to set host_key_checking=false in the host’s file but it does not work.
Our Support Engineers checked and found errors with the command.
In the host key checking, ssh automatically maintains and checks a database that contains identification for all hosts it has ever been used with.
And, StrictHostKeyChecking helps to control logins to machines whose host key has changed.
Setting this argument “no” prompt ssh to automatically add new host keys to the user known hosts files.
And, We can disable it in the host/inventory level or global level.
To disable it at the inventory level, we use the below command.
Similarly, to disable it at the host level,
Inventory/hosts method appears to be more secure but it only works with connection type ssh and not paramiko.
Also, to do it at the global level, we add the following in /etc/ansible/ansible.cfg.
host_key_checking = False
Therefore, using these methods, we can disable the host key checking.
Finally, the file looks as below
[Need more assistance to disable it?- We’ll help you.]
In short, we can do Ansible disable host key checking either at the inventory/hosts level or at the global level. In today’s writeup, we discussed how our Support Engineers disable it easily for our customers.