Reputation: 899
I have few files in cookbook under files (blah-cookbook/files/default/file01*.xml)
When I run chef-client, it populates on destination directory (/etc/app/file01*.xml) - Good so far.
cookbook_file "/tmp/file01.xml" do
source "file01"
owner "root"
group "root"
mode 00600
action :create
end
Lets say I remove few files from cookbook files, how do I make it reflect on destination directory ? I would like to have identical files on destination direcotry (/etc/app/file) and cookbook files (blah-cookbook/files/default/file01.xml). No more, no less.
Upvotes: 1
Views: 423
Reputation: 54211
You might want to be using a remote_directory
resource for this, but more likely you should use some other kind of file packaging/distribution system as Chef's internal tools for it are incredibly minimal. A shared git repository (with a git
resource) or a deb/RPM package (with package
resource) are both popular options.
Upvotes: 1
Reputation: 37600
You have to explicitly remove them (at least during one chef-client run):
file "/etc/foo" do
action :delete
end
The remote_file
resource also offers a :delete
action that you could use, if you want.
Upvotes: 1