Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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? Basically how can I call on a .ps1 located on the server from a chef client?

like image 240
Derongan Avatar asked Jul 16 '14 20:07

Derongan


1 Answers

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 "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.

like image 114
Matt Avatar answered Oct 09 '22 23:10

Matt