Ansible“无法通过ssh连接到主机

时间:2016-11-10 19:37:21

标签: ssh vagrant ansible virtualbox permission-denied

我正在使用VirtualBox,Vagrant和Ansible。 它工作正常,直到我跑

ssh vagrant@10.10.10.10

并获得以下输出:

The authenticity of host '10.10.10.10 (10.10.10.10)' can't be established.
ECDSA key fingerprint is
SHA256:IIbQq8qenKqUEpurYCMbbaRBCHXEgWK4Br7KSusmyw4.
Are you sure you want to continue connecting (yes/no)?

我输入“是”,从那时起每次输入vagrant provision时,我都会这样:

fatal: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: Warning: Permanently added '10.10.10.10' (ECDSA) to the list of known hosts.\r\nPermission denied ().\r\n", "unreachable": true}

然后我从~/.ssh/known_hosts删除了生成的密钥,但我一直收到同样的错误。

1 个答案:

答案 0 :(得分:0)

经过大量时间寻找答案后,我找到了适合我的解决方案。我将以下几行添加到我的Vagrantfile并重新加载vm

ansible.raw_arguments = [
"--private-key=~/path/to/.vagrant/machines/default/virtualbox/private_key"
]