2017-05-08 71 views
0

我正在虚拟机上的Windows自动化工作,并创建了一个相同的烹饪书,一旦虚拟机创建我试图引导与运行以下命令(写在PowerShell资源下)命令的厨师服务器的节点。刀引导失败

"knife bootstrap windows winrm $myip -x $myusername -P $mypassword -N $VMName" 

如果我直接我的PowerShell窗口上执行该命令其正常运行,加上当CMD执行test.ps1文件就可以正常运行:

"C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -File "C:\Users\test.ps1 

这是我得到的时候运行食谱是错误:

 
Recipe: vmauto::default 
    * powershell_script[vmcreate] action run[2017-05-08T16:59:35+05:30] INFO: Processing powershell_script[vmcreate] action run (vmauto::default line 9) 

[execute] Bootstrap the VM created to chef server 
      knife bootstrap windows winrm 172.xx.xx.xx -x 'admin' -P 'password' -N TestVM32 
      WARNING: No knife configuration file foundWARN: Failed to read the private key C:\chef\client.pem: # 
      ERROR: Your private key could not be loaded from C:\chef\client.pem 
      Check your configuration file and ensure that your private key is readable 
      Bootstrap completed 

[2017-05-08T16:59:45+05:30] INFO: powershell_script[vmcreate] ran successfully 
    - execute "C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -File "C:/Users/xxxx.xxxx/AppData/Local/Temp/chef-script20170508-14000-18hpixg.ps1" 
[2017-05-08T16:59:45+05:30] WARN: Skipping final node save because override_runlist was given 
[2017-05-08T16:59:45+05:30] INFO: Chef Run complete in 10.046277 seconds 
[2017-05-08T16:59:45+05:30] INFO: Skipping removal of unused files from the cache 

回答

0

听起来好像没有找到刀具配置,所以它没有引导参数。我会通过--config明确地通过它,而不是尝试对各种用户和主目录问题进行分类以找到.chef/knife.rb