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?

Thanks

edit retag flag offensive close merge delete