Ansible:SSH 错误:ControlPath 太长 [英] Ansible : SSH Error: ControlPath too long

查看:24
本文介绍了Ansible:SSH 错误:ControlPath 太长的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 Ubuntu 15.10 运行计算机,并尝试使用 Ansible 运行 Vagrant.

在开始之前,我想说我对服务器管理一无所知,尤其是Ansible.

我打算以这种方式运行我的系统的原因是因为我已经开始着手一个需要这种安装的项目.

毕竟,我遇到的问题是,在配置 Vagrant 时,我收到以下消息

为用户建立连接:vagrant<aaa.dev>REMOTE_MODULE 设置<aaa.dev>EXEC ssh -C -tt -vvv -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o IdentityFile=/media/merianos/Large Internal/Vagrant/ansible-project/.vagrant/machines/default/virtualbox/private_key -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/home/merianos/.ansible/cp/%h-%r" -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=30 aaa.dev/bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1446622406.54-199921739516776 &&chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1446622406.54-199921739516776 &&echo $HOME/.ansible/tmp/ansible-tmp-1446622406.54-199921739516776'致命的:[aaa.dev] =>SSH 错误:ControlPath 太长有时使用 -vvvv 重新运行命令会很有用,它会打印 SSH 调试输出以帮助诊断问题.

那么,可以帮我解决这个问题吗?

只是说我已经尝试过这篇文章:https://github.com/ansible/ansible/issues/11536 并且我将 ansible.cfg 中的 control_path 更改为 control_path = %(directory)s/%%h-%%r 但仍然无法正常工作.

注意我的安装路径包含一个空间,我无法删除它,因为在同一个 HDD 上运行许多其他项目,并且所有项目的配置都很大.我不知道这个空间是否有问题,但我只是说一下.

更新 #1

在我更改任何内容之前的结果:

为用户建立连接:vagrant<aaa.dev>REMOTE_MODULE 设置<aaa.dev>EXEC ssh -C -tt -vvv -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o IdentityFile=/media/merianos/Large Internal/Vagrant/ansible-project/.vagrant/machines/default/virtualbox/private_key -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/home/merianos/.ansible/cp/ansible-ssh-%h-%p-%r" -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=30 aaa.dev/bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1446628138.53-155680153347939 &&chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1446628138.53-155680153347939 &&echo $HOME/.ansible/tmp/ansible-tmp-1446628138.53-155680153347939'致命的:[aaa.dev] =>SSH 错误:ControlPath 太长有时使用 -vvvv 重新运行命令会很有用,它会打印 SSH 调试输出以帮助诊断问题.

control_path = %(directory)s/%%h-%%r 的结果:

为用户建立连接:vagrant<aaa.dev>REMOTE_MODULE 设置<aaa.dev>EXEC ssh -C -tt -vvv -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o IdentityFile=/media/merianos/Large Internal/Vagrant/ansible-project/.vagrant/machines/default/virtualbox/private_key -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/home/merianos/.ansible/cp/%h-%r" -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=30 aaa.dev/bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1446628320.4-231606404275563 &&chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1446628320.4-231606404275563 &&echo $HOME/.ansible/tmp/ansible-tmp-1446628320.4-231606404275563'致命的:[aaa.dev] =>SSH 错误:ControlPath 太长有时使用 -vvvv 重新运行命令会很有用,它会打印 SSH 调试输出以帮助诊断问题.

更新 #2

在我设置 ssh_args = -o ControlMaster=off 后,我得到以下结果:

为用户建立连接:vagrant<aaa.dev>REMOTE_MODULE 设置<aaa.dev>EXEC ssh -C -tt -vvv -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o IdentityFile=/media/merianos/Large Internal/Vagrant/ansible-project/.vagrant/machines/default/virtualbox/private_key -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/home/merianos/.ansible/cp/ansible-ssh-%h-%p-%r" -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=30 aaa.dev/bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1446628489.4-10074395967553 &&chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1446628489.4-10074395967553 &&echo $HOME/.ansible/tmp/ansible-tmp-1446628489.4-10074395967553'致命的:[aaa.dev] =>SSH 错误:ControlPath 太长有时使用 -vvvv 重新运行命令会很有用,它会打印 SSH 调试输出以帮助诊断问题.

一般来说,对于我所做的每次修改,错误消息似乎都是相同的,并且可能是从其他级别发生的配置,而不是 ansible.cfg.

不幸的是我不知道在哪里可以找到那个位置:(

解决方案

我在类似问题中描述了这个问题.

您需要将其更改为更短的内容(如果您的主机名很长).对于测试用例,您可以只尝试 ./master,但对于实际用例,您至少应该使用 ./s/%%h-%%r.

I run a computer with Ubuntu 15.10 and I try to run Vagrant with Ansible.

Before start, I like to say that I don't have any idea about server management and especialy the Ansible.

The reason I am going to run my system this way, is because I have start working on a project that requires this installation.

After all, the problem I have is that while provisioning the Vagrant I get the following message

<aaa.dev> ESTABLISH CONNECTION FOR USER: vagrant
<aaa.dev> REMOTE_MODULE setup
<aaa.dev> EXEC ssh -C -tt -vvv -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o IdentityFile=/media/merianos/Large Internal/Vagrant/ansible-project/.vagrant/machines/default/virtualbox/private_key -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/home/merianos/.ansible/cp/%h-%r" -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=30 aaa.dev /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1446622406.54-199921739516776 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1446622406.54-199921739516776 && echo $HOME/.ansible/tmp/ansible-tmp-1446622406.54-199921739516776'
fatal: [aaa.dev] => SSH Error: ControlPath too long
It is sometimes useful to re-run the command using -vvvv, which prints SSH debug output to help diagnose the issue.

So, is it posible to help me someone with this issue ?

Just to say that I have try this article : https://github.com/ansible/ansible/issues/11536 and I changed the control_path in my ansible.cfg to control_path = %(directory)s/%%h-%%r but still not working.

Note My installation path contains a space that I can't remove it because are running many other projects on the same HDD and the configuration will be huge for all the projects. I don't know if that space is the problem, but just I say about it.

UPDATE #1

Result before I change anything:

<aaa.dev> ESTABLISH CONNECTION FOR USER: vagrant
<aaa.dev> REMOTE_MODULE setup
<aaa.dev> EXEC ssh -C -tt -vvv -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o IdentityFile=/media/merianos/Large Internal/Vagrant/ansible-project/.vagrant/machines/default/virtualbox/private_key -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/home/merianos/.ansible/cp/ansible-ssh-%h-%p-%r" -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=30 aaa.dev /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1446628138.53-155680153347939 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1446628138.53-155680153347939 && echo $HOME/.ansible/tmp/ansible-tmp-1446628138.53-155680153347939'
fatal: [aaa.dev] => SSH Error: ControlPath too long
It is sometimes useful to re-run the command using -vvvv, which prints SSH debug output to help diagnose the issue.

Result with control_path = %(directory)s/%%h-%%r :

<aaa.dev> ESTABLISH CONNECTION FOR USER: vagrant
<aaa.dev> REMOTE_MODULE setup
<aaa.dev> EXEC ssh -C -tt -vvv -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o IdentityFile=/media/merianos/Large Internal/Vagrant/ansible-project/.vagrant/machines/default/virtualbox/private_key -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/home/merianos/.ansible/cp/%h-%r" -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=30 aaa.dev /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1446628320.4-231606404275563 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1446628320.4-231606404275563 && echo $HOME/.ansible/tmp/ansible-tmp-1446628320.4-231606404275563'
fatal: [aaa.dev] => SSH Error: ControlPath too long
It is sometimes useful to re-run the command using -vvvv, which prints SSH debug output to help diagnose the issue.

UPDATE #2

After I set the ssh_args = -o ControlMaster=off I get the following result:

<aaa.dev> ESTABLISH CONNECTION FOR USER: vagrant
<aaa.dev> REMOTE_MODULE setup
<aaa.dev> EXEC ssh -C -tt -vvv -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o IdentityFile=/media/merianos/Large Internal/Vagrant/ansible-project/.vagrant/machines/default/virtualbox/private_key -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/home/merianos/.ansible/cp/ansible-ssh-%h-%p-%r" -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=30 aaa.dev /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1446628489.4-10074395967553 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1446628489.4-10074395967553 && echo $HOME/.ansible/tmp/ansible-tmp-1446628489.4-10074395967553'
fatal: [aaa.dev] => SSH Error: ControlPath too long
It is sometimes useful to re-run the command using -vvvv, which prints SSH debug output to help diagnose the issue.

In general for each modification I did, the error message seems to be the same, and maybe the configuration it happens from some other level, but not the ansible.cfg.

Unfortunatelly I don't know where to find that location :(

解决方案

I described the problem in similar question.

You need to change it to something shorter (if you have long hostname). For test case you can try just ./master, but for real use case, you should use at least ./s/%%h-%%r.

这篇关于Ansible:SSH 错误:ControlPath 太长的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆