流浪者/安斯布尔SSH错误



尝试使用 Vagrant 和 Ansible 预配 Azure VM 时出现以下错误:

➜  remote-dev git:(master) ✗ vagrant provision app
==> app: Running provisioner: ansible...
app: Running ansible-playbook...
PYTHONUNBUFFERED=1 ANSIBLE_FORCE_COLOR=true ANSIBLE_HOST_KEY_CHECKING=false ANSIBLE_SSH_ARGS='-o UserKnownHostsFile=/        dev/null -o IdentitiesOnly=yes -o ControlMaster=auto -o ControlPersist=60s' ansible-playbook --connection=ssh --timeout=30 --limit="app"         --inventory-file=/Users/user/vagrant/remote-dev/.vagrant/provisioners/ansible/inventory -vvvv site.yml
Using /Users/user/vagrant/remote-dev/ansible.cfg as config file
Loading callback plugin default of type stdout, v2.0 from /usr/local/Cellar/ansible/2.2.0.0_2/libexec/lib/python2.7/site-packages/ansible/plugins/        callback/__init__.pyc
PLAYBOOK: site.yml *************************************************************
1 plays in site.yml
PLAY [all] *********************************************************************
TASK [setup] *******************************************************************
Using module file /usr/local/Cellar/ansible/2.2.0.0_2/libexec/lib/python2.7/site-packages/ansible/modules/core/system/setup.py
<name.eastus.cloudapp.azure.com> ESTABLISH SSH CONNECTION FOR USER: vagrant
<name.eastus.cloudapp.azure.com> SSH: EXEC ssh -vvv -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o ControlMaster=auto -o         ControlPersist=60s -o StrictHostKeyChecking=no -o Port=22 -o 'IdentityFile="/Users/user/.ssh/vagrant.key"' -o KbdInteractiveAuthentication=no -o         PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=30 -o         ControlPath=/Users/user/.ansible/cp/ansible-ssh-%h-%p-%r name.eastus.cloudapp.azure.com '/bin/sh -c '"'"'sudo -H -S -n -u root /bin/sh -c         '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-nplltooivdpoedgryzzyimyktrvyeduu; /usr/bin/python'"'"'"'"'"'"'"'"' && sleep 0'"'"''
fatal: [app]: UNREACHABLE! => {
"changed": false,
"msg": "SSH Error: data could not be sent to the remote host. Make sure this host can be reached over ssh",
"unreachable": true
}

平有效:

➜  remote-dev git:(master) ✗ ansible app -m ping
app | SUCCESS => {
"changed": false,
"ping": "pong"
}

运行 ansible 剧本也是如此:

ansible-playbook appservers.yml

我的主机文件:

app ansible_ssh_host=name.eastus.cloudapp.azure.com ansible_ssh_port=22 ansible_ssh_user='vagrant' ansible_ssh_private_key_file='/Users/user/.ssh/vagrant.key'

看起来修复它的方法是在[ssh_connection]下向我的 ansible 添加control_path = %(directory)s/%%h-%%p-%%r.cfg

.在运行在调试输出中找到的下面复制的完整 ansible ssh 命令并收到此错误后,我走了这条路:

debug3: muxserver_listen: temporary control path /Users/<user>/.ansible/cp/<fqdn>
unix_listener: "/Users/<user>/.ansible/cp/<fqdn>" too long for Unix domain socket
ssh -vvv -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -i
/Users/<user>/.ssh/vagrant.key -o ForwardAgent=yes -o
ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no
-o Port=22 -o 'IdentityFile="/Users/<user>/.ssh/vagrant.key"' -o KbdInteractiveAuthentication=no -o
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey
-o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=90 -o ControlPath=/Users/<user>/.ansible/cp/<fqdn> '/bin/sh -c'

在问题 #11536 中找到答案。

最新更新