Ask Your Question

puppet file copy

asked 2014-09-02 15:19:33 -0600

mandm_zoom gravatar image

updated 2014-09-02 17:52:10 -0600

ramindk gravatar image

I am creating my own module to copy files from master to client servers and here are the details of the init.pp

class copyfiles {
 # download the file
    file { "/tmp/files" :
        ensure  => directory,
        source  => "puppet:///modules/copyfiles",
        recurse => true,
        owner   => "me",
        group   => "me",
        backup  => false,
        notify  => Exec["copy files"],

 # copy the pem file to the desired location
    exec { "copy files":
        subscribe   => File["/tmp/files"],
        refreshonly => true,
        command     => "/bin/cp -rp /tmp/files/*.files /var/www/",

I have 2 problems, 1) How can i copy only the files that was the newest instead of copying all the files like i do in my command statement? 2) how can i recopy existing file, because since the file exists in /tmp/files the puppet client won't copy the newer file?


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-07-23 23:51:46 -0600

binford2k gravatar image

You don't need to copy files into place. Just manage the files you want to exist and let Puppet do its job.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-09-02 15:19:33 -0600

Seen: 2,170 times

Last updated: Jul 23