diff --git a/manifests/borg.pp b/manifests/borg.pp index ff569de..c9614a4 100644 --- a/manifests/borg.pp +++ b/manifests/borg.pp @@ -4,6 +4,9 @@ class wmdeit_backup::borg ( $repos = $borg_repos, $scripts = $borg_scripts + + + ) inherits wmdeit_backup::params @@ -30,10 +33,15 @@ define wmdeit_backup::borg_backup $ssh_user = 'root', $ssh_port = '22', $ssh_check_hostkey = 'no', + $borg_options = $wmdeit_backup::borg::borg_options, $weekday = undef, $hour = '0', $minute = '0', + + $retain_daily = '30', + $retain_monthly = '6', + $retain_yearly = '0', ) { $scripts = $wmdeit_backup::borg::scripts @@ -66,10 +74,13 @@ export BORG_PASSPHRASE=$passphrase D=`date +%F` $wmdeit_backup::borg::sshfs_cmd $sshfs_options -oStrictHostKeyChecking=$ssh_check_hostkey -oPort=$ssh_port $ssh_user@$server:/ $mnt cd $mnt -CMD=\"$borg_cmd create ${repo}::$title-\${D} $backup_dirs\" +CMD=\"$borg_cmd create $borg_options ${repo}::$title-\${D} $backup_dirs\" \$CMD cd / umount $mnt +PRUNECMD=\"$borg_cmd prune -d $retain_daily -m $retain_monthly -y $retain_yearly ${repo}\" +\$PRUNECMD + " diff --git a/manifests/params.pp b/manifests/params.pp index f2795e7..ca929bc 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -12,7 +12,7 @@ class wmdeit_backup::params { ] $sshfs_cmd = '/usr/local/bin/sshfs' - $sshfs_options = '-o direct_io' # buggy sshfs driver under freebsd + $sshfs_options = '-o reconnect -o direct_io' # buggy sshfs driver under freebsd $borg_cmd = "/usr/local/bin/borg" } 'Debian': { @@ -32,6 +32,7 @@ class wmdeit_backup::params { $borg_repos = "/tank/backups" $borg_scripts = "/root/borg" $borg_mnt = "/mnt" + $borg_options = "--nobsdflags --files-cache=ctime,size" }