May 2015
Intermediate to advanced
278 pages
5h 34m
English
If your node is not under complete Chef control, it might be necessary to trigger commands when Chef changes a file. For example, you might want to restart a service that is not managed by Chef when its configuration file (which is managed by Chef) changes. Let's see how you can achieve this with Chef.
Make sure that you have a cookbook called my_cookbook and that the run_list of your node includes my_cookbook, as described in the Creating and using cookbooks recipe in Chapter 1, Chef Infrastructure.
Let's create an empty file as a trigger and run a bash command, if that file changes:
mma@laptop:~/chef-repo $ subl cookbooks/my_cookbook/recipes/default.rb ...Read now
Unlock full access