这是一个已知问题,我找到了解决方案,但它对我不起作用。
首先我有:
fatal: [openshift-node-compute-e50xx] => 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.
所以我创建了一个~/.ansible.cfg
。其内容:
[ssh_connection]
control_path=%(directory)s/%%h‐%%r
但是重新运行我的 ansible 后,我仍然有一个关于“太长”的错误。
fatal: [openshift-master-32axx] => SSH Error: unix_listener: "/Users/myuser/.ansible/cp/ec2-xx-xx-xx-xx.eu-central-1.compute.amazonaws.com-centos.AAZFTHkT5xXXXXXX" too long for Unix domain socket
while connecting to 52.xx.xx.xx:22
It is sometimes useful to re-run the command using -vvvv, which prints SSH debug output to help diagnose the issue.
为什么还是太长?
最佳答案
限制为 104 或 108 个字符。 (我在网上找到了不同的说法)
您在错误消息中删除了一些敏感信息,因此不清楚您的路径实际有多长。
我猜 %(directory)s
已替换为用户文件夹中的 .ansible
目录。删除它并直接使用您的用户文件夹将为您节省 12 个字符:
control_path=~/%%h‐%%r
当然,这会使用控制套接字向您的主目录发送垃圾邮件。
根据您的用户名的实际长度,您可以看看是否可以创建另一个目录或在任何地方找到更短的路径。例如,我使用 ~/.ssh/tmp/%%h_%%r
只少了 3 个字符,但已经足够了。
最后,如果这些都没有帮助,您仍然可以使用 /tmp
来存储套接字。但请注意,任何有权访问该计算机上的 /tmp
的人都可能能够使用您的套接字。
关于ssh - Ansible:SSH 错误:unix_listener:对于 Unix 域套接字来说太长,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35970686/