Is there a way to ignore part of a templated file?
I have a service which has a config file and each time the service starts it writes the start time in the config file. This makes puppet detect a change and since I have it notifying the service it will restart the service. I don't want puppet to restart the service shortly after I have just started it.
So is there a way for to make puppet ignore part of a templated file?
I don't think this is possible, puppet calculates an md5 of the file to check for file changes. Is it possible to write the start time to another file?
My solution is similiar to Zoredache's, but varies slightly in that you don't need an intelligent script to do the comparison.
Let's say your configuration file is
/etc/my_application.conf
and it looks like this:In puppet, add a file to files/ for your configuration file, that looks like:
Then, use a manifest that deployes the file to an alternate location, and if changes exist, triggers a copy that then triggers the service, like so:
This allows you to restart on new configuration changes, but will not restart the service if my_application.conf is modified locally. This isn't a perfect solution because it does not save you from local modifications, but hopefully you can manage those with permissions and a clear warning at the top of the configuration file.