How to set host_key_checking=false in ansible inventory file?


I would like to use ansible-playbook command instead of ‘vagrant provision‘. However setting host_key_checking=false in the hosts file does not seem to work.

Is there a configuration variable outside of Vagrantfile that can override this value?


Due to the fact that I answered this in 2014, I have updated my answer to account for more recent versions of ansible.

Yes, you can do it at the host/inventory level (Which became possible on newer ansible versions) or global level:


Add the following.


Add the following.

hosts/inventory options will work with connection type ssh and not paramiko. Some people may strongly argue that inventory and hosts is more secure because the scope is more limited.


Ansible User Guide – Host Key Checking

  • You can do it either in the /etc/ansible/ansible.cfg or ~/.ansible.cfg file:
  • Or you can setup and env variable (this might not work on newer ansible versions):

Leave a Reply