Puppet 2.7 Ensure file on client updates when puppet:///file is updated on Master

file-sharingpuppetpuppetmaster

I have a Perl script that I pushed out to all my Puppet Linux clients. I have since edited my script, module/modulename/files/scripts/a_script script on the Puppet master, but the clients don't get the change because they have the file. Apparently it doesnt checksum or use modtime. What is the best practice to ensure the files are up to date wit the master version? Do I need to write checksum logic, or is there already built in functionality?

The code I used to initially push was:

file { '/sbin/a_script':
    ensure => present,
    mode => 744,
    owner => root,
    source => "puppet:///modulename/scripts/a_script"
}

Obviously deleting the file and having it pull it back is a hacky solution, I am hoping for something more eloquent.

UPDATE
Puppet does checksum and sync files in the puppet:/// filebucket on next run, I must have had an error that caused the file declaration to not be run. When I moved the declaration to site.pp it did sync the changes to the already existing files on clients.

Best Answer

I would suggest serving your scripts out of a flat directory structure, e.g. puppet:///modulename/a_script instead of puppet:///modulename/scripts/a_script

But if that's not an option, this sounds like a use case for the recurse directive. Without it, the default action seems to only ensure that your file is present, without regard to content.

Also check out the Puppet File Type Reference.

-- Edit --

I thought you were trying to sync a directory of scripts.

For your case, Puppet defaults to replace => true on a File type if the source checksum changes.

What's your output from puppet agent -t (or puppet agent --debug -t) on the client systems?