在 Linux 上从 Ansible 连接 winrm 模块

Connecting winrm module from Ansible on Linux

我正在使用 linux 上托管的 ansible 在 Azure 上管理 linux 和 Windows 虚拟机。当我尝试使用

从 ansible ping windows 虚拟机时
# ansible windows -m win_ping

我遇到以下错误:

test-windows.cloudapp.net | FAILED >> {
"failed": true, 
"msg": "The term 'ConvertFrom-Json' is not recognized as the name of a cmdlet, function\r\n, script file, or operable program. Check the spelling of the name, or if a pat\r\nh was included, verify that the path is correct and try again.\r\nAt C:\Users\coremedia\AppData\Local\Temp\ansible-tmp-1424263716.9-1357614051035\r\n00\win_ping.ps1:54 char:67\r\n+         $parameters = Get-Content $arguments[0] | ConvertFrom-Json <<<< ;\r\n    + CategoryInfo          : ObjectNotFound: (ConvertFrom-Json:String) [], Co \r\n   mmandNotFoundException\r\n    + FullyQualifiedErrorId : CommandNotFoundException\r\n \r\nThe term 'ConvertTo-Json' is not recognized as the name of a cmdlet, function, \r\nscript file, or operable program. Check the spelling of the name, or if a path \r\nwas included, verify that the path is correct and try again.\r\nAt C:\Users\coremedia\AppData\Local\Temp\ansible-tmp-1424263716.9-1357614051035\r\n00\win_ping.ps1:85 char:31\r\n+     echo $obj | ConvertTo-Json <<<<  -Depth 99\r\n    + CategoryInfo          : ObjectNotFound: (ConvertTo-Json:String) [], Comm \r\n   andNotFoundException\r\n    + FullyQualifiedErrorId : CommandNotFoundException\r\n \r\n", 
"parsed": false

}

windows 机器安装了 Powershell 4。

有什么想法吗?

是我的错误,windows服务器2008默认安装了Powershell 2.0,升级到Powershell 3解决了ping问题。但还有另一个问题 "process terminated due to stack overflow exception",解决方案已在下面的论坛中讨论

https://groups.google.com/forum/#!topic/ansible-project/Rpvuidq5XeA