aboutsummaryrefslogtreecommitdiff
path: root/manifests/subsystem/backup.pp
blob: bfdffaabb5ef55a6d01901d3fe13f086c0e3b443 (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
class nodo::subsystem::backup {
  #
  # Backup
  #
  class { '::backup': }

  $local_backup = lookup('nodo::subsystem::backup::localhost', undef, undef, false)

  # Local encrypted backup
  case $local_backup {
    true,enabled,present: {
      backup::duplicity { "localhost":
        encryptkey => lookup('nodo::subsystem::backup::encryptkey', undef, undef, false),
        password   => lookup('nodo::subsystem::backup::password'),
      }
    }
    false,absent: {
      backup::duplicity { "localhost":
        encryptkey => lookup('nodo::subsystem::backup::encryptkey', undef, undef, false),
        password   => lookup('nodo::subsystem::backup::password', undef, undef,   false),
        ensure     => absent,
      }
    }
    default: { }
  }

  # Setup rsync instances
  $rsync = lookup('backup::rsync', undef, undef, {})
  create_resources('backup::rsync', $rsync)

  # Setup borg instances
  $borg = lookup('backup::borg', undef, undef, {})
  create_resources('backup::borg', $borg)
}