0
我有一些问题,因为我无法在本地主机上ping服务器。我创建该文件的主机,这就是代码:ansible ping localhost
testserver ansible_ssh_host=127.0.0.1 ansible_ssh_port=2200 \ ansible_ssh_user=vagrant \ ansible_ssh_private_key_file=.vagrant/machines/default/virtualbox/private_key
我使用Fedora和我的虚拟化Debian中的VirtualBox 4.3
这就是附加在外壳:
[[email protected] ~]$ ansible testserver -i /home/andrea/playbooks/hosts -m ping -vvvv
<127.0.0.1> ESTABLISH CONNECTION FOR USER: andrea
<127.0.0.1> REMOTE_MODULE ping
<127.0.0.1> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/home/andrea/.ansible/cp/ansible-ssh-%h-%p-%r" -o Port=2200 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 127.0.0.1 /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1445357197.49-202989636750564 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1445357197.49-202989636750564 && echo $HOME/.ansible/tmp/ansible-tmp-1445357197.49-202989636750564'
testserver | FAILED => SSH Error: Permission denied (publickey,password).
while connecting to 127.0.0.1:2200
It is sometimes useful to re-run the command using -vvvv, which prints SSH debug output to help diagnose the issue.
你首先需要做'SSH -i .vagrant /机/默认/ VirtualBox虚拟/ PRIVATE_KEY 127.0.0.1:2200'工作。您是否将Vagrant VM的ssh端口转发到主机上的端口2200?私密金钥是否在Vagrant嘉宾内正确设置? –
如果我使用你的代码我得到登录屏幕。但是我创建了没有密码的机器,只有私钥 –