How to move/copy files locally with Chef

前端 未结 8 1490
感情败类
感情败类 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:39

    I know this question have already been answered, and discussed, but here is the method I use when creating files.

    1. First include the file under the cookbook's files/default folder
    2. Then on your recipe use the cookbook_file resource

    e.g:

    cookbook_file "/server/path/to/file.ext" do
      source "filename.ext"
      owner "root"
      group "root"
      mode 00600
      action :create_if_missing
    end
    

    From chef documentation: http://docs.opscode.com/resource_cookbook_file.html

    The cookbook_file resource is used to transfer files from a sub-directory of the files/ directory in a cookbook to a specified path that is located on the host running the chef-client or chef-solo.

提交回复
热议问题