Ansible SSH 错误 [英] Ansible SSH Error

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

问题描述

我在 ubuntu 14.04 上的 ansible 1.9.4 中遇到了一个与 ssh 相关的奇怪错误.

I am running into a weird ssh related error in ansible 1.9.4 on ubuntu 14.04.

在我的清单文件中,我定义了多个服务器,例如:

In my inventory file I have several servers defined in groups something like:

[group1]
g1-server1
g1-server2

[group2]
g2-server1
g2-server2
....
[dev]
g1-server1 .... 
g2-server1 ...
etc.....

所有服务器现在都指向 localhost 进行测试.我还为每个服务器分配了几个变量.

All servers are now pointing to localhost for testing. There are also several variables I am assigning to each server.

我可以逐个任务(使用标签)运行剧本任务,有时相同的任务有效,有时无效.如果我运行整个剧本,它将在随机位置停止并出现此错误:

I can run playbook task by task (using tags) and sometimes the same task works, sometimes it doesn't. If I run the entire playbook it will stop at random location with this error:

fatal: [hostname] => SSH Error: Shared connection to 127.0.0.1 closed.
It is sometimes useful to re-run the command using -vvvv, which prints    
SSH debug output to help diagnose the issue.

我怀疑这可能是从 localhost 到 localhost 同时进行许多 ssh 连接的问题,但我不确定如何确认这一点.此外,如果任务被标记为 run_once: true,我会取得更大的成功.

I suspect it may be an issue with many ssh connections at the same time from localhost to localhost, but I am not sure how to confirm this. Also, I have much greater success with tasks if they are marked run_once: true.

有人对此有任何想法吗?

Does anyone have any ideas on this on?

注意:我试图在互联网上找到一些关于此的资源;有几个与服务器重启相关的讨论.但是请记住,我不会在这里重新启动任何东西.

Note: I tried to find some resources on interwebs on this; there are several discussions related to server rebooting. However keep in mind I am not rebooting anything here.

推荐答案

如果我没猜错,您将打开多个执行相同操作的连接(例如更改相同的文件).这当然会导致不可预测的结果.

If I got you right you are opening multiple connections which do the same thing (for example changing the same files). This of course will cause unpredictable results.

尽管我认为这种测试没有任何意义,但您可以消除错误设置

Despite the fact that I do not see any sense in this sort of testing, you can eliminate the error setting

serial: 1

在您的剧本中,请参阅:http://docs.ansible.com/ansible/playbooks_delegation.html#rolling-update-batch-size

in your playbook, see: http://docs.ansible.com/ansible/playbooks_delegation.html#rolling-update-batch-size

这将导致任务一个接一个地运行

which will cause the tasks to run one after another

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

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