Ask Your Question
0

copy file if source file and destination file does not match

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

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
2

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

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": https://docs.puppetlabs.com/references/latest/type.html#file-attribute-checksum

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

Stats

Asked: 2015-02-04 13:42:51 -0500

Seen: 985 times

Last updated: Feb 05 '15