2016-03-08 82 views
-1

任务:我试图从ansible ssh到Windows机器,程序卡住

name: Connect to Windows hpst machine through an ssh script 
script : windows_connect.ssh 
name: Run the bat file 
script : C:\OV\sentenv.bat 
name: To exit from the remote machine 
shell: exit 

这就是我的剧本的样子。

Windows_connect.sh包含通过ssh连接到Windows机器的脚本。

ssh [email protected] 

所以理想情况下不应该提示我输入密码? 反而卡住了。

请帮我用同样

+0

那是没有有效的任务定义。 *如果*这个工作,你没有正确复制它。请使用您的工作剧本内容更新您的问题。 – udondan

+0

--- - 主机:16.184.41.150 任务: - 名称:通过SSH脚本连接到Windows主机 壳:windows_connect.ssh - 名称:运行批处理文件 外壳上:mkdir -p /家用/帕瓦西/试验 - 名称 - : “release_version” 提示: “产品发行版本” 默认: “1.0” ... –

+0

此:退出 vars_prompt:名称 要从远程机器 壳退出是确切的yml文件!对不起格式 –

回答

1

Ansible打开了在剧中每一个任务的至少一个新的ssh连接。

因此,打开与第一个任务的ssh连接,然后在后面的任务中重新使用连接的想法将无法工作。实际上,Ansible将无法执行第一项任务,因为您尝试使用的script module将需要与远程主机建立工作连接。

我发现很少有关于Ansible将使用多少ssh连接来执行任务,所以我可能在这里是错误的。

您应该查阅Ansible documentation for Window support并实施基于winrm Python模块的解决方案。