How to move/copy files locally with Chef

前端 未结 8 1461
感情败类
感情败类 2020-12-02 12:07

I haven\'t yet come across a Chef resource that will copy/move files locally. For example, I want to download jetty hightide and unzip it. Once done, copy all the files into

相关标签:
8条回答
  • 2020-12-02 12:56

    You could give the ark cookbook a try. This extracts the file for you and you afterwards notice an execute resource.

    0 讨论(0)
  • 2020-12-02 12:57

    If your recipe is already tied to Windows, you can use embedded PowerShell scripts, like this:

    # Copy files from "C:/foo/lib" to "C:/foo"
    powershell_script "copy_lib" do
      code <<-EOH
        $ErrorActionPreference = "Stop"
          Get-ChildItem -Path "C:/foo/lib" -File | Foreach-Object {
            Copy-Item -Path $_.Fullname -Destination "C:/foo" -Force
          }
      EOH
    end
    
    # Delete "C:/foo/lib" folder
    powershell_script "delete_lib" do
      code <<-EOH
        $ErrorActionPreference = "Stop"
        Remove-Item -Path "C:/foo/lib" -Recurse
      EOH
    end
    
    0 讨论(0)
提交回复
热议问题