lov*_*ova 13 ssh amazon-ec2 ansible
这是一个已知的问题,我找到了一个解决方案,但它对我不起作用.
首先我有:
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.
Run Code Online (Sandbox Code Playgroud)
所以我创建了一个~/.ansible.cfg
.它的内容:
[ssh_connection]
control_path=%(directory)s/%%h?%%r
Run Code Online (Sandbox Code Playgroud)
但是在重新运行我的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.
Run Code Online (Sandbox Code Playgroud)
为什么还太长?
udo*_*dan 19
限制为104或108个字符.(我在网上发现了不同的陈述)
您在错误消息中列出了一些敏感信息,因此不清楚您的路径实际存在多长时间.
我想%(directory)s
用.ansible
users文件夹中的目录替换.删除它并直接使用您的用户文件夹可以节省12个字符:
control_path=~/%%h?%%r
Run Code Online (Sandbox Code Playgroud)
当然,这将使用控件套接字将您的主目录垃圾邮件.
根据用户名的实际长度,您可以看到是否可以创建另一个目录或在任何地方找到更短的路径.例如,我用~/.ssh/tmp/%%h_%%r
只有3个字符少,但足够了.
最后,如果没有任何帮助,你仍然可以退回使用/tmp
存储套接字.但请注意,有权访问/tmp
该计算机的任何人都可以使用您的套接字.
只是补充一点,正如错误所示,当控制路径对于 Unix 域套接字来说太长时,通常会发生此问题,因此,具体到 ansible。
您可以通过更新配置文件以使用 %C 格式而不是 %r@%h:%p 轻松解决此问题,如下所示:
$ mkdir ~/.ssh/control
$ vim ~/.ssh/config
Host *
ControlPath ~/.ssh/control/%C
ControlMaster auto
Run Code Online (Sandbox Code Playgroud)
更多详细信息: man ssh_config 将 %C 格式定义为“连接的哈希值:%l%h%p%r”。并参考这里。
定制control_path
解决方案可以为我解决问题。这是在不向主目录发送垃圾邮件的情况下执行此操作的方法。
的control_path
默认为(文档):
control_path=%(directory)s/ansible-ssh-%%h-%%p-%%r
Run Code Online (Sandbox Code Playgroud)
编辑Ansible配置。
vim ~/.ansible.cfg
Run Code Online (Sandbox Code Playgroud)
以下是具有新control_path
值的示例文件内容:
[defaults]
inventory=/etc/ansible/hosts
[ssh_connection]
control_path=%(directory)s/%%h-%%r
control_path_dir=~/.ansible/cp
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
5445 次 |
最近记录: |