Ansible SSH错误 [英] Ansible SSH Error

查看:148
本文介绍了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.....

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

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.

我怀疑从本地主机到本地主机同时存在许多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天全站免登陆