aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--modules/rsnapshot/manifests/init.pp32
-rw-r--r--modules/rsnapshot/templates/rsnapshot.conf48
2 files changed, 51 insertions, 29 deletions
diff --git a/modules/rsnapshot/manifests/init.pp b/modules/rsnapshot/manifests/init.pp
index 129e05fd..15b54735 100644
--- a/modules/rsnapshot/manifests/init.pp
+++ b/modules/rsnapshot/manifests/init.pp
@@ -1,5 +1,35 @@
class rsnapshot {
- class base {
+ class base($confdir = '/backups/conf') {
package { ['rsnapshot']: }
+
+ file { $confdir:
+ ensure => directory,
+ owner => root,
+ group => root,
+ mode => 0700,
+ }
+ }
+
+ # - 'backup' is an array of "source destination" to backup
+ # - 'backup_script' is an array of "script destination"
+ # - ${x}_interval is the number of hourly, daily, weekly, monthly
+ # backups that should be kept. If you don't want hourly, daily,
+ # weekly or monthly backups, set ${x}_interval to '0'
+ define backup(
+ $snapshot_root = '/backups',
+ $one_fs = '1',
+ $backup = [],
+ $backup_script = [],
+ $hourly_interval = '0',
+ $daily_interval = '6',
+ $weekly_interval = '4',
+ $monthly_interval = '3'
+ ) {
+ file { "${rsnapshot::base::confdir}/${name}.conf":
+ owner => root,
+ group => root,
+ mode => 0700,
+ content => template('rsnapshot/rsnapshot.conf'),
+ }
}
}
diff --git a/modules/rsnapshot/templates/rsnapshot.conf b/modules/rsnapshot/templates/rsnapshot.conf
index 9a6232c5..37502aa8 100644
--- a/modules/rsnapshot/templates/rsnapshot.conf
+++ b/modules/rsnapshot/templates/rsnapshot.conf
@@ -86,10 +86,18 @@ cmd_rsnapshot_diff /usr/bin/rsnapshot-diff
# i.e. hourly, daily, weekly, etc. #
#########################################
-interval hourly 6
-interval daily 7
-interval weekly 4
-#interval monthly 3
+<%- if @hourly_interval != '0' -%>
+interval hourly <%= @hourly_interval %>
+<%- end -%>
+<%- if @daily_interval != '0' -%>
+interval daily <%= @daily_interval %>
+<%- end -%>
+<%- if @weekly_interval != '0' -%>
+interval weekly <%= @weekly_interval %>
+<%- end -%>
+<%- if @monthly_interval != '0' -%>
+interval monthly <%= @monthly_interval %>
+<%- end -%>
############################################
# GLOBAL OPTIONS #
@@ -141,7 +149,7 @@ lockfile /var/run/rsnapshot.pid
# backup point. This essentially passes the -x option to rsync.
# The default is 0 (off).
#
-#one_fs 0
+one_fs <%= @one_fs %>
# The include and exclude parameters, if enabled, simply get passed directly
# to rsync. If you have multiple include/exclude patterns, put each one on a
@@ -192,27 +200,11 @@ link_dest 1
### BACKUP POINTS / SCRIPTS ###
###############################
-# LOCALHOST
-backup /home/ localhost/
-backup /etc/ localhost/
-backup /usr/ localhost/
-#backup /var/log/rsnapshot localhost/
-#backup /etc/passwd localhost/
-#backup /home/foo/My Documents/ localhost/
-#backup /foo/bar/ localhost/ one_fs=1, rsync_short_args=-urltvpog
-#backup_script /usr/bin/backup_pgsql.sh localhost/postgres/
-
-# EXAMPLE.COM
-#backup_script /bin/date "+ backup of example.com started at %c" unused1
-#backup root@example.com:/home/ example.com/ +rsync_long_args=--bwlimit=16,exclude=core
-#backup root@example.com:/etc/ example.com/ exclude=mtab,exclude=core
-#backup_script ssh root@example.com "mysqldump -A > /var/db/dump/mysql.sql" unused2
-#backup root@example.com:/var/db/dump/ example.com/
-#backup_script /bin/date "+ backup of example.com ended at %c" unused9
-
-# CVS.SOURCEFORGE.NET
-#backup_script /usr/bin/backup_rsnapshot_cvsroot.sh rsnapshot.cvs.sourceforge.net/
-
-# RSYNC.SAMBA.ORG
-#backup rsync://rsync.samba.org/rsyncftp/ rsync.samba.org/rsyncftp/
+<%- for b in @backup -%>
+backup <%= b %>
+<%- end -%>
+
+<%- for bs in @backup_script -%>
+backup_script <%= bs %>
+<%- end -%>