2016-11-10 111 views
0

我在VirtualBox中,流浪和Ansible工作连接到主机 它工作得很好,直到我跑Ansible“无法通过ssh

ssh [email protected] 

,得到了下面的输出:

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中删除生成的密钥,但我一直得到相同的错误。

+0

当您在保存'Vagrantfile'的相同文件夹中运行'vagrant ssh'时会发生什么? –

+0

我可以ssh进入vm就好了,但我无法配置它。 – MariaVincent

+0

另外,我尝试使用不同版本的VirtualBox,Vagrant和Ansible来卸载并安装它,但是这个错误并没有消失。 – MariaVincent

回答

0

经过大量的时间寻找答案,我找到了解决方案,为我工作。我将以下几行添加到我的Vagrant文​​件并重新加载vm

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