无法在Windows上引导Chef

时间:2014-05-22 17:26:36

标签: windows chef

我承认 - 我是Linux SysAd,没有Windows管理,所以我认为Chef会让我更容易。男孩,我错了: - )

这就是事情。我试图在安装了cygwin / ssh的Windows 2008r2机器上引导Chef - 所以我尝试的引导程序自然是通过ssh。

现在,在通过疯狂的故障排除在本地修复了一些刀窗错误之后,我发现主厨下载的powershell脚本失败并出现无法识别的错误: - )

以下是详细信息:

knifep bootstrap windows ssh SERVER.AWS.COM -N wintest -x Administrator --environment "dev" --bootstrap-version 11.6.2
...
....
SERVER.AWS.COM C:\cygwin\home\Administrator>cscript /nologo C:\chef\wget.vbs /url:"https://www.opscode.com/chef/download?p=windows&pv=2008r2&m=x86_64&v=11.6.2" /path:"C:\cygwin\tmp\chef-client-latest.msi"
SERVER.AWS.COM C:\chef\wget.vbs(31, 1) (null): The specified module could not be found.
SERVER.AWS.COM
SERVER.AWS.COM Failed download: download completed, but downloaded file not found
SERVER.AWS.COM Warning: Failed to download "https://www.opscode.com/chef/download?p=windows&pv=2008r2&m=x86_64&v=11.6.2" to "C:\cygwin\tmp\chef-client-latest.msi"
SERVER.AWS.COM Warning: Retrying download with PowerShell if available...
SERVER.AWS.COM !powershell_download!
SERVER.AWS.COM Downloaded: "https://www.opscode.com/chef/download?p=windows&pv=2008r2&m=x86_64&v=11.6.2&DownloadContext=PowerShell" "C:\cygwin\tmp\chef-client-latest.msi"
SERVER.AWS.COM Download via PowerShell succeeded.
SERVER.AWS.COM Installing downloaded client package...
SERVER.AWS.COM
SERVER.AWS.COM C:\cygwin\home\Administrator>msiexec /qn /log "C:\cygwin\tmp\chef-client-msi4840.log" /i "C:\cygwin\tmp\chef-client-latest.msi"
SERVER.AWS.COM This installation package could not be opened.  Verify that the package exists and that you can access it, or contact the application vendor to verify that this is a valid Windows Installer package.
Chef-client package failed to install with status code !ERRORLEVEL!.
SERVER.AWS.COM See installation log for additional detail: C:\cygwin\tmp\chef-client-msi4840.log.

现在,我喜欢..cool,让我们看一下日志文件,看看出了什么问题!这是: - )

milosgajdos@magnolia ~ $ ssh Administrator@SERVER.AWS.COM
Last login: Thu May 22 17:02:50 2014 from 82.211.87.195

Administrator@ip-0A3AA70D ~
$ ls -ltr /tmp/
total 32
-rw-r--r--  1 Admin         None  393 May 22 16:49 root.key
-rw-r--r--  1 Admin         None 2606 May 22 16:50 keys.tmp
-rw-r--r--  1 Admin         None  387 May 22 16:50 updatekeys.log
-rwxr-xr-x  1 Administrator None 9813 May 22 16:58 bootstrap-13677-1400777903.bat
-rwxr-xr-x  1 Administrator None    2 May 22 16:59 chef-client-msi4020.log
-rwxr-xr-x  1 Administrator None 9810 May 22 17:02 bootstrap-13718-1400778159.bat
-rwxr-xr-x  1 Administrator None    2 May 22 17:02 chef-client-msi4840.log
drwxrwxrwx+ 1 Admin         None    0 May 22 17:07 sudo

Administrator@ip-0A3AA70D ~
$ cat /tmp/chef-client-msi4840.log
��
Administrator@ip-0A3AA70D ~
$

Errrrr,w000000t ?!

是的,经过数小时的挫折后,我决定通过远程桌面手动执行此操作。 我安装了厨师omnibus软件包并测试是否安装了chef-client并得到RBconfig错误:

Administrator@ip-0A3AA70D /cygdrive/c
$ sudo chef-client -v
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/windows-api-0.4.0/lib/windows/api.rb:4: Use RbConfig instead of obsolete and deprecated Config.
Chef: 11.6.2

在此之后,我放弃并尝试通过忽略上述警告来注册节点。它确实成功了。

任何人都知道为什么下载引导程序脚本说它没有成功,并且导致引导程序完全失败? 谢谢!

2 个答案:

答案 0 :(得分:1)

我花了一些时间来克服使用WinRM的恐惧,这种配置看起来很吓人。看到这篇文章就会带来恐惧,我现在肯定会过渡到SSH,因为我现在更好地与Chef一起经验丰富。但是我要把我当前的引导过程放在这里讨论。基本上,我们的想法是使用一个用于输入所需信息的批处理文件(或GUI)来自动化每一步。

先决条件:Machine running knife-windows命令与目标计算机位于同一专用网络上。即用于本地专用网络的个人工作站,用作AWS通过专用网络进行通信的工作站的云服务器

  1. PsExec配置WinRM

    psexec.exe \\%IP% -u %USERNAME% -p %PASSWORD% -h -c "winrm_config.bat"
    
    • " winrm_config.bat"

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

    knife bootstrap windows winrm %IP% -r 'role[%ROLE%]' -x %USERNAME% -P %PASSWORD% -N %NAME%
    
  3. 重置WinRM(配方在引导后立即运行)

    winrm invoke Restore winrm/Config
    
  4. 这些是我采取的步骤,目前正用于最大限度地提高使用WinRM进行自举的安全性。

答案 1 :(得分:0)

我尝试使用Windows远程管理而不是使用winssh尝试使用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

这可能对你有帮助。