Search code examples
puppetpuppet-enterprisepuppetlabs-apache

puppet update a configuration file only if it is updated


I have configured puppet master and agent for a small cluster. I know that for file transfer, I have to user file resource of puppet and it will overwrite existing file and if given it will also restart the service. Is there a way to update file on agent only if it is update ? I have found an option "replace" that do not write updated file to the given location if that file already exist. But what happen if the old file have old content ? How to do this


Solution

  • From the comments, I understand that you want to allow the agent's copy of the file to drift and be updated only if it changes again on the master.

    This is not possible. And if you think about how Puppet works, you might realise it would be difficult to add a feature like this into the Puppet File type. While figuring out whether the desired state is different from the actual state is easy enough, how could Puppet distinguish between "drift" caused by local changes made outside of Puppet, and "drift" caused by a new version of the file being published in the manifests - or both?