# Disable host key checking when triggering Ansible from Python app

**URL:** <https://forum.ansible.com/t/disable-host-key-checking-when-triggering-ansible-from-python-app/17088>\
**Category:** Ansible Project\
**Created:** [December 17, 2014, 9:21am UTC](https://forum.ansible.com/t/disable-host-key-checking-when-triggering-ansible-from-python-app/17088 "2014-12-17T09:21:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pavel1](https://avatars.discourse-cdn.com/v4/letter/p/d78d45/32.png) [@pavel1](https://forum.ansible.com/u/pavel1)\
**Post date:** [December 17, 2014, 9:21am UTC](https://forum.ansible.com/t/disable-host-key-checking-when-triggering-ansible-from-python-app/17088/1 "2014-12-17T09:21:19Z")

</div>

Hello everyone,

I’m trying to trigger Ansible run from a Python application and I can’t disable host key checking.

I’ve already tried:

- passing parameter via extra\_vars in the same manner as from CLI, and then transforming it into a dictionary the same way as in ansible-playbook
- assembling a dictionary with the parameters

It keeps asking if I want to continue connecting to the host.

extra\_vars is evaluated like this now: {u’host\_key\_checking’: u’no’, u’record\_host\_keys’: u’no’}

Could anyone advise please?

Kind regards,  
Pavel Chunyayev

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [December 17, 2014, 1:18pm UTC](https://forum.ansible.com/t/disable-host-key-checking-when-triggering-ansible-from-python-app/17088/2 "2014-12-17T13:18:01Z")

</div>

In the future these types of questions should probably go to ansible-devel, not ansible-project.

You can do this by manipulating the “constant”.

import ansible.constants as C  
C.HOST\_KEY\_CHECKING = False
