aboutsummaryrefslogtreecommitdiff
path: root/manifests/borg.pp
blob: e0279843577c98c3533fec554cf138e39460f568 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
define backup::borg(
    $port           = '22',
    $ensure         = present,
    $keepdaily      = '7',
    $keepweekly     = '4',
    $keepmonthly    = '3',
    $user           = $::hostname,
    $host           = "${title}.${::domain}",
    $encryption     = 'repokey',
    $order          = 95,
    $periodic_check = absent,
    $password,
) {
  $exclude_unencrypted = $backup::params::exclude_unencrypted
  $include_unencrypted = $backup::params::include_unencrypted

  file { "${backupninja::configdir}/${order}_borg-${host}.sh":
    ensure  => $ensure,
    content => template('backup/borg.sh.erb'),
    owner   => root,
    group   => root,
    mode    => '0600',
    require => File["${backupninja::configdir}"],
  }

  cron { "borg_check-$title.$domain":
    command  => "/bin/bash ${backupninja::configdir}/${order}_borg-${host}.sh --check",
    user     => root,
    hour     => "0",
    minute   => "0",
    weekday  => "0",
    ensure   => $periodic_check,
  }
}