· They can be managed on a per-resource basis using the atomic_update property that is available with the cookbook_file, file, remote_file, and template resources. Note On certain platforms, and after a file has been moved into place, the chef-client may modify file permissions to support features specific to those platforms. · for one file. What if I want to download multiple files in a same place with different urls? Or how can I modify this resource to make multiple downloads which have different URLs? This is how I added attributes in recipe: node['file']['name'].each do |pkg| remote_file "path/plugins/#{pkg}" do source "node['file']['url']/#{pkg}" action Reviews: 3. · I'm using Chef to download a war file into a folder from topfind247.co Recipe is as below remote_file '/home/Test/topfind247.co' do source 'topfind247.co URL Of the Repo/topfind247.co' owner Reviews: 1.
It provides a file, remote file, and cookbook file to manage files and a resource to manage directories. Directories. Create, remove, and manage directory permissions; Owner and group will be kept default for the client, usually the root. Defaults can make cookbooks more concise although they shouldn't be confusing. Files. cookbook_file¶. Use the cookbook_file resource to transfer files from a sub-directory of COOKBOOK_NAME/files/ to a specified path located on a host that is running the chef-client or chef-solo. The file is selected according to file specificity, which allows different source files to be used based on the hostname, host platform (operating system, distro, or as appropriate), or platform version. The file provisioner is also able to upload a complete directory to the remote machine. When uploading a directory, there are a few important things you should know. First, when using the ssh connection type the destination directory must already exist.
Use the package resource to manage packages. When the package is installed from a local file (such as with RubyGems, dpkg, or RPM Package Manager), the file must be added to the node using the remote_file or cookbook_file resources. This resource is the base resource for several other resources used for package management on specific platforms. “remote_file” resource is the chef resource which is used to retrieve remote files. The name passed to the remote_file resource is the destination where the remote file need to be stored and in this case is the temporary cache directory used by Chef. The download is defined to happen only if the tar file is not already available in the cache thus preventing unnecessary download. The use_conditional_get attribute is the default behavior of Chef Infra Client. If the remote file is located on a server that supports ETag and/or If-Modified-Since headers, Chef Infra Client will use a conditional GET to determine if the file has been updated. If the file has been updated, Chef Infra Client will re-download the file.
0コメント