こういうmanifestを用意した。
file { '/home/hfm/test':
content => "world\n",
backup => true,
}helloと書かれたtestファイルを用意。
[hfm@main ~]$ cat test
hello
applyしてみる。
[hfm@main ~]$ puppet apply filebackup.pp -v --show_diff
info: Applying configuration version '1401092074'
--- /home/hfm/test 2014-05-26 17:13:54.543145991 +0900
+++ /tmp/puppet-file20140526-24990-15ge2hg-0 2014-05-26 17:14:34.579142465 +0900
@@ -1 +1 @@
-hello
+world
notice: /Stage[main]//File[/home/hfm/test]/content: content changed '{md5}b1946ac92492d2347c6235b4d2611184' to '{md5}591785b794601e212b260e25925636fd'
notice: Finished catalog run in 0.42 seconds
testとtest.puppet-bakが用意される。
mtimeを見る限り、元のファイルをmvしただけとか、そういう感じなのかな。
[hfm@main ~]$ ll test*
-rw-r--r-- 1 hfm tokyo-server-admin 6 5月 26 17:14 2014 test
-rw-r--r-- 1 hfm tokyo-server-admin 6 5月 26 17:13 2014 test.puppet-bak
中身はこの通り。
[hfm@main ~]$ cat test
world
[hfm@main ~]$ cat test.puppet-bak
hello