summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2018-12-09 15:42:04 +0000
committerintrigeri <intrigeri@boum.org>2018-12-09 15:42:04 +0000
commit37a4661eb291f0a6cc8b6932218fcb97e59b3867 (patch)
treeb3602f6cd77c02e7186e9b2924b8e9d374d4cd9b
parentd958e1216e19a5260e80c6376cf9d5d5a2ad93fd (diff)
https://puppet.com/docs/puppet/4.8/lang_conditional.html#selectors
-rw-r--r--manifests/borgbackup/lv.pp27
1 files changed, 8 insertions, 19 deletions
diff --git a/manifests/borgbackup/lv.pp b/manifests/borgbackup/lv.pp
index 801137b..a2f71a3 100644
--- a/manifests/borgbackup/lv.pp
+++ b/manifests/borgbackup/lv.pp
@@ -12,25 +12,14 @@ define tails::borgbackup::lv (
include tails::borgbackup
- if $rawdisk {
- cron { "runbackup ${lv}":
- command => "/usr/local/sbin/runbackuplv.sh -v '${vg}' -l '${lv}' -u '${backupuser}' -s '${backupserver}' -b '${basedir}' -r '${repo}' -d",
- user => root,
- weekday => fqdn_rand(7, $title),
- hour => fqdn_rand(24, $title),
- minute => fqdn_rand(60, $title),
- require => Class['tails::borgbackup'],
- }
- }
- else {
- cron { "runbackup ${lv}":
- command => "/usr/local/sbin/runbackuplv.sh -v '${vg}' -l '${lv}' -u '${backupuser}' -s '${backupserver}' -b '${basedir}' -r '${repo}'",
- user => root,
- weekday => fqdn_rand(7, $title),
- hour => fqdn_rand(24, $title),
- minute => fqdn_rand(60, $title),
- require => Class['tails::borgbackup'],
- }
+ $runbackup_options = $rawdisk ? { true => '-d', default : '' }
+ cron { "runbackup ${lv}":
+ command => "/usr/local/sbin/runbackuplv.sh -v '${vg}' -l '${lv}' -u '${backupuser}' -s '${backupserver}' -b '${basedir}' -r '${repo}' ${runbackup_options}",
+ user => root,
+ weekday => fqdn_rand(7, $title),
+ hour => fqdn_rand(24, $title),
+ minute => fqdn_rand(60, $title),
+ require => Class['tails::borgbackup'],
}
exec { "/usr/bin/borg init --encryption=keyfile --append-only '${backupuser}@${backupserver}:${basedir}/${repo}'":