【发布时间】:2017-10-06 09:33:04
【问题描述】:
我正在 Windows 上进行 VM 自动化,并为此创建了一本食谱,一旦创建了 VM,我将尝试使用运行以下命令(在 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
我在运行说明书时遇到的错误是:
配方: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) [执行] 将创建的虚拟机引导到厨师服务器 刀引导 windows winrm 172.xx.xx.xx -x 'admin' -P 'password' -N TestVM32 警告:没有找到刀配置文件警告:无法读取私钥 C:\chef\client.pem:# 错误:无法从 C:\chef\client.pem 加载您的私钥 检查您的配置文件并确保您的私钥是可读的 引导完成 [2017-05-08T16:59:45+05:30] 信息:powershell_script[vmcreate] 运行成功 - 执行 "C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -File "C:/Users/xxxx.xxxx/AppData/Local/Temp/厨师脚本20170508-14000-18hpixg.ps1" [2017-05-08T16:59:45+05:30] 警告:跳过最终节点保存,因为给出了 override_runlist [2017-05-08T16:59:45+05:30] 信息:Chef Run 在 10.046277 秒内完成 [2017-05-08T16:59:45+05:30] 信息:跳过从缓存中删除未使用的文件【问题讨论】:
标签: windows powershell chef-infra chef-recipe