Disable host key checking when triggering Ansible from Python app

38 views
Skip to first unread message

pa...@backbase.com

unread,
Dec 17, 2014, 4:21:19 AM12/17/14
to ansible...@googlegroups.com
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

Matt Martz

unread,
Dec 17, 2014, 8:18:47 AM12/17/14
to ansible...@googlegroups.com
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
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/aba2db6e-8455-449d-a476-dec7137d5fa6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages