无法禁用 Ansible 的主机密钥检查 [英] Can't disable Ansible's host key checking
问题描述
我正在使用 Ansible 1.5.4 在 Ubuntu 14.04 LTS 上配置我的 Vagrant 1.4.3 框.
I'm using Ansible 1.5.4 to provision my Vagrant 1.4.3 box on Ubuntu 14.04 LTS.
我在详细模式下收到以下错误消息:
I'm getting the following error message in verbose mode:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
我可以这样做:export ANSIBLE_HOST_KEY_CHECKING=False
我的~/.ansible.cfg
中有以下几行:
I can do: export ANSIBLE_HOST_KEY_CHECKING=False
and I have following lines in my ~/.ansible.cfg
:
[defaults]
host_key_checking = False
但这无济于事.
可能是什么问题?谢谢!
What could be the problem? Thank you!
我是这样直接调用的(不使用 vagrant
命令):
I'm calling it directly like this (without using vagrant
command):
ansible-playbook playbook.yml -i inventory.ini --user=vagrant --ask-pass -vvvv
库存为:
[default]
localhost:2222
推荐答案
您需要通过项目的 Vagrantfile
进行设置.当 Vagrant Ansible 供应商调用 ansible-playbook
时,它总是 设置ANSIBLE_HOST_KEY_CHECKING
环境变量的值.
You'll need to set it via the Vagrantfile
of the project. When the Vagrant Ansible provisioner makes the call to ansible-playbook
it always sets the value of the ANSIBLE_HOST_KEY_CHECKING
environment variable.
Ansible 本身 获取环境的价值变量(如果存在).因此 Vagrant 将覆盖您的 ansible.cfg
中使用的值.
Ansible itself takes the value of the environment variable if present. Therefore Vagrant will override the value used in your ansible.cfg
.
因此,您只需要以下内容:
Therefore you just need something like:
machine.vm.provision :ansible do |ansible|
ansible.host_key_checking = false
# etc.
end
这篇关于无法禁用 Ansible 的主机密钥检查的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!