Ask Your Question

copy file if source file and destination file does not match

asked 2015-02-04 13:42:51 -0600

singaravelan gravatar image

I want to copy/replace the file to a node if the timestamp of the source file (ex : source puppet:///deployfiles/test.war ) destination will be /opt/staging/webapps/test.war.

can we write this one in puppet ?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-02-05 21:44:59 -0600

GregLarkin gravatar image

Yes, you can do something like so:

file { '/opt/staging/webapps/test.war':
  ensure   => file,
  checksum => 'mtime',
  source   => 'puppet:///modules/deployfiles/test.war',

The checksum attribute can be very useful for modifying the file resource's idea of "changed":

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: 2015-02-04 13:42:51 -0600

Seen: 1,248 times

Last updated: Feb 05 '15