来自Mac OS X工作站的knife bootstrap windows winrm失败

时间:2013-06-06 16:18:00

标签: windows chef knife

从我的Mac OS X工作站运行命令knife bootstrap windows winrm ec2box.amazonaws.com -r 'role[web]' -x Administrator -P 'mypassword'会产生下面的输出。从Windows工作站运行它,命令成功运行。我需要采取额外的步骤才能使我的Mac OS X工作站正确地通过WinRM进行通信吗?

我在亚马逊的Windows Server 2012 AMI上使用它。它在我的终端上打印了#39,而不是Stack Overflow的工件。

WARNING: Could not load IOV methods. Check your GSSAPI C library for an update
WARNING: Could not load AEAD methods. Check your GSSAPI C library for an update
Bootstrapping Chef on ec2box.amazonaws.com
ec2box.amazonaws.com "Rendering 'C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-7738-1370535154.bat' chunk 1"
ec2box.amazonaws.com "Rendering 'C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-7738-1370535154.bat' chunk 2"
ec2box.amazonaws.com '#39' is not recognized as an internal or external command,
ec2box.amazonaws.com operable program or batch file.
ec2box.amazonaws.com "Rendering 'C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-7738-1370535154.bat' chunk 3"
ec2box.amazonaws.com "Rendering 'C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-7738-1370535154.bat' chunk 4"
ec2box.amazonaws.com '#39' is not recognized as an internal or external command,
ec2box.amazonaws.com operable program or batch file.
ec2box.amazonaws.com '#39' is not recognized as an internal or external command,
ec2box.amazonaws.com operable program or batch file.
ec2box.amazonaws.com "Rendering 'C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-7738-1370535154.bat' chunk 5"
ec2box.amazonaws.com "Rendering 'C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-7738-1370535154.bat' chunk 6"
ec2box.amazonaws.com "Rendering 'C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-7738-1370535154.bat' chunk 7"
ec2box.amazonaws.com "Rendering 'C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-7738-1370535154.bat' chunk 8"
ec2box.amazonaws.com "Rendering 'C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-7738-1370535154.bat' chunk 9"
ec2box.amazonaws.com
ec2box.amazonaws.com else was unexpected at this time.
ec2box.amazonaws.com C:\Users\Administrator>mkdir C:\chef
ec2box.amazonaws.com
ec2box.amazonaws.com C:\Users\Administrator>(
ec2box.amazonaws.com echo.url = WScript.Arguments.Named("url")
ec2box.amazonaws.com  echo.path = WScript.Arguments.Named("path")
ec2box.amazonaws.com  echo.proxy = null
ec2box.amazonaws.com  echo.Set objXMLHTTP = CreateObject("MSXML2.ServerXMLHTTP")
ec2box.amazonaws.com  echo.Set wshShell = CreateObject( "WScript.Shell" )
ec2box.amazonaws.com  echo.Set objUserVariables = wshShell.Environment("USER")
ec2box.amazonaws.com  echo.
ec2box.amazonaws.com  echo.
ec2box.amazonaws.com  echo.On Error Goto 0
ec2box.amazonaws.com  echo.
ec2box.amazonaws.com  echo.objXMLHTTP.open "GET", url, false
ec2box.amazonaws.com  echo.objXMLHTTP.send()
ec2box.amazonaws.com  echo.If objXMLHTTP.Status = 200 Then
ec2box.amazonaws.com  echo.Set objADOStream = CreateObject("ADODB.Stream")
ec2box.amazonaws.com  echo.objADOStream.Open
ec2box.amazonaws.com  echo.objADOStream.Type = 1
ec2box.amazonaws.com  echo.objADOStream.Write objXMLHTTP.ResponseBody
ec2box.amazonaws.com  echo.objADOStream.Position = 0
ec2box.amazonaws.com  echo.Set objFSO = Createobject("Scripting.FileSystemObject")
ec2box.amazonaws.com  echo.If objFSO.Fileexists(path) Then objFSO.DeleteFile path
ec2box.amazonaws.com  echo.Set objFSO = Nothing
ec2box.amazonaws.com  echo.objADOStream.SaveToFile path
ec2box.amazonaws.com  echo.objADOStream.Close
ec2box.amazonaws.com  echo.Set objADOStream = Nothing
ec2box.amazonaws.com  echo.End if
ec2box.amazonaws.com  echo.Set objXMLHTTP = Nothing
ec2box.amazonaws.com ) 1>C:\chef\wget.vbs
ec2box.amazonaws.com
ec2box.amazonaws.com C:\Users\Administrator>(
ec2box.amazonaws.com echo.param(
ec2box.amazonaws.com  echo.   [String] $remoteUrl,
ec2box.amazonaws.com  echo.   [String] $localPath
ec2box.amazonaws.com  echo.)
ec2box.amazonaws.com  echo.
ec2box.amazonaws.com  echo.$webClient = new-object System.Net.WebClient;
ec2box.amazonaws.com  echo.
ec2box.amazonaws.com  echo.$webClient.DownloadFile($remoteUrl, $localPath);
ec2box.amazonaws.com ) 1>C:\chef\wget.ps1
ec2box.amazonaws.com C:\Users\Administrator>) else (

4 个答案:

答案 0 :(得分:2)

我遇到了类似的问题。我做的是:

卸载gem,然后进行aptitude更新,然后安装gem&刀口窗口插件在这个loaction(/ opt / chef / embedded / bin / gem安装刀 - 窗口),并打开5985端口并配置winrm:

  1.winrm quickconfig -q   
  2.winrm set winrm/config/winrs @{MaxMemoryPerShellMB="300"}  
  3.winrm set winrm/config @{MaxTimeoutms="1800000"}  
  4.winrm set winrm/config/service @{AllowUnencrypted="true"}   
  5.winrm set winrm/config/service/auth @{Basic="true"}

然后引导:

knife bootstrap windows winrm ec2-xx-xxx-xx.compute-1.amazonaws.com -r 'recipe[cookbook]' -x Administrator -P xxxxxxxx -N "WIN-xxxxx"

答案 1 :(得分:1)

它似乎适用于刀窗0.5.10 [使用Windows Server 2008R2测试]

使用以下命令安装:

gem uninstall knife-windows
gem install knife-windows -v 0.5.10   

检查你的宝石:

gem list|grep knife-windows

它应该显示:

knife-windows (0.5.10)  

答案 2 :(得分:1)

我的OSX上的#39个字符存在完全相同的问题,请参阅我对它的描述:Stuck trying to bootstrap Windows server using Chef

就我而言,rvm是负责任的罪魁祸首。

我设法通过以下步骤解决此问题: 1)下载并运行omnibus安装程序

curl -L https://www.opscode.com/chef/install.sh | sudo bash

2)使用系统ruby禁用rvm:

rvm use system 

3)直接在厨师图书馆安装刀窗:

sudo /opt/chef/embedded/bin/gem install knife-windows

这与在https://github.com/opscode/knife-windows上建议配置Windows 2008服务器一起使用 (此要点中提供的命令:https://gist.github.com/jimcroft/3878113) 做了伎俩,我可以引导我的节点:) 阿形

答案 3 :(得分:1)

看起来问题可能与Ruby 2.x和winrm gem之间的互操作性差有关:

https://github.com/WinRb/WinRM/pull/73