aboutsummaryrefslogtreecommitdiffstats
path: root/modules/git/manifests/snapshot.pp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/git/manifests/snapshot.pp')
-rw-r--r--modules/git/manifests/snapshot.pp22
1 files changed, 22 insertions, 0 deletions
diff --git a/modules/git/manifests/snapshot.pp b/modules/git/manifests/snapshot.pp
new file mode 100644
index 00000000..8b903700
--- /dev/null
+++ b/modules/git/manifests/snapshot.pp
@@ -0,0 +1,22 @@
+define git::snapshot( $source,
+ $refresh = '*/5',
+ $user = 'root') {
+ include git::client
+ #TODO
+ # should handle branch -> clone -n + branch + checkout
+ # create a script
+ # Idealy, should be handled by vcsrepo
+ # https://github.com/bruce/puppet-vcsrepo
+ # once it is merged in puppet
+ exec { "/usr/bin/git clone $source $name":
+ creates => $name,
+ user => $user
+ }
+
+ cron { "update $name":
+ # FIXME no -q ?
+ command => "cd $name && /usr/bin/git pull",
+ user => $user,
+ minute => $refresh
+ }
+}