[英]Chef Powershell Run from File
Using chef's powershell_script provider how would I reference a file stored on the chef server instead of having the code defined in the same file? 使用chef的powershell_script提供程序,如何引用存储在chef服务器上的文件,而不是在同一个文件中定义代码? Basically how can I call on a .ps1 located on the server from a chef client? 基本上我如何从厨师客户端调用位于服务器上的.ps1?
You can call unsigned powershell scripts directly within powershell_script
, as long as your execution policy allows it , which Chef does by default. 您可以直接在powershell_script
调用unsigned powershell脚本,只要您的执行策略允许它 ,默认情况下Chef会执行 。
powershell_script "run some script" do
code "c:/something/script.ps1"
end
If you want chef to deploy the script too, you can do it from the /files
section of the cookbook with cookbook_file
. 如果您希望chef也部署脚本,您可以使用cookbook_file
从cookbook的/files
部分执行此操作。
对于多行代码,不要忘记在powershell_script资源的代码参数中的每行末尾添加\\ n。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.