I have a chef cookbook that has a bunch of files that end in ".txt" in my /files/default folder. How can I add to my chef recipe a way to move all files that end in ".txt" from my files directory to a specific directory on my node?
Here is what I have:
remote_directory "/opt/info" do
source [/*.txt/]
owner 'root'
group 'root'
mode '0640'
end
The source
property of remote_directory
resource takes a directory name in files/default
of the cookbook, and not files.
So you should move your *.txt
files to files/default/info
. Example contents:
file1.txt
file2.txt
file3.txt
file4.txt
file5.txt
file6.txt
Then in your recipe specify the info
directory in which *.txt
files are present:
remote_directory '/opt/info' do
source 'info'
owner 'root'
group 'root'
mode '0640'
end
This will copy all files from files/default/info
of your cookbook to /opt/info
on the node.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.