I have the following scenario:
Suppose i have configuration file A which is copied during sever provisioning at any location example: "/temp" using chef recipes and after someday someone modified 2-3 parameter in the configuration file.
Is this possible to find out such files and rollback to old one or copied A file again to the /temp location.
Thanks
If file A
is managed by your chef recipe then running chef-client
again will correct any drift in the file to whatever is in your chef recipe for it's contents.
For example if you have:
file '/tmp/fileA.txt' do
content 'foo'
action :create
end
Then someone changes the content of /tmp/fileA.txt
to bar
then on your next chef-client run it will update the content to foo
again.
Or if you are pulling in a file from the cookbook like:
cookbook_file '/tmp/fileA.txt' do
source 'fileA.txt'
action :create
end
Then someone updates /tmp/fileA.txt
the next time you run chef-client
it will pull the file from your cookbook again.
Or if you want to use a locally stored file you can do that as well:
remote_file '/tmp/fileA.txt' do
source 'file:///tmp/fileAsource.txt'
action :create
end
Here the file:///tmp/fileAsource.txt
syntax is referring to the local filesystem file /tmp/fileAsource.txt
. If the content changes from whats in the source file it will update /tmp/fileA.txt