在Linux上连接Ansible的winrm模块

时间:2015-02-18 12:58:56

标签: linux powershell azure ansible

我在linux上使用ansible来管理azure上的linux和Windows VM。当我尝试使用

从ansible ping Windows VM时
# 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。

任何想法?

1 个答案:

答案 0 :(得分:0)

这是我的错误,默认情况下在Windows Server 2008中安装了Powershell 2.0,并将其升级到Powershell 3解决了ping问题。但还有另一个问题叫做#34;由于堆栈溢出异常导致进程终止&#34;,该解决方案在下面的论坛中进行了讨论

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