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嘉賓內正確設置? –
如果我使用你的代碼我得到登錄屏幕。但是我創建了沒有密碼的機器,只有私鑰 –