-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathpush.pp
More file actions
63 lines (63 loc) · 2.61 KB
/
push.pp
File metadata and controls
63 lines (63 loc) · 2.61 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Borg Push (Client) Server
#
# @param archives Array of absolute paths to archives to backup.
#
# @param remote_user Optional remote user for SSH. Defaults to $::common::backup::borg::remote_user.
#
# @param remote_ip Remote IP address or FQDN. Defaults to $::common::backup::borg::remote_ip.
#
# @param password Optional password for the remote backup. Defaults to undef.
#
# @param remote_backup_root The root directory for remote backups. Defaults to $::common::backup::borg::remote_backup_root.
#
# @param randomized_delay Optional delay to randomize backup timing. Defaults to $::common::backup::borg::randomized_delay.
#
# @param timespec Scheduled time for backups. Defaults to $::common::backup::borg::timespec.
define common::backup::borg::push (
Array[Stdlib::Absolutepath] $archives,
Optional[Eit_types::User] $remote_user = $::common::backup::borg::remote_user,
Variant[Eit_types::IP, Stdlib::FQDN] $remote_ip = $::common::backup::borg::remote_ip,
Optional[Eit_types::Password] $password = undef,
Stdlib::Absolutepath $remote_backup_root = $::common::backup::borg::remote_backup_root,
Optional[Eit_types::SystemdTimeSpan] $randomized_delay = $::common::backup::borg::randomized_delay,
Optional[Eit_types::SystemdTime] $timespec = $::common::backup::borg::timespec,
) {
$_ssh_key_file = '/etc/obmondo/borg/borg_id_rsa'
$_reponame = $name
$_backup_root = "${remote_backup_root}/${facts['networking']['hostname']}"
::borgbackup::archive { $_reponame :
reponame => $_reponame,
create_includes => $archives,
}
::borgbackup::repo { $_reponame:
reponame => $_reponame,
remote_user => $remote_user,
remote_ip => $remote_ip,
backup_root => $_backup_root,
passphrase => $password,
ssh_key_file => $_ssh_key_file,
passcommand => '',
env_vars => {
'BORG_RSH' => "ssh -i ${_ssh_key_file} -o BatchMode=yes",
},
crontab_define => 'systemd::unit_file',
crontabs => {
"obmondo-backup-borg@${_reponame}.timer" => {
ensure => true, #lint:ignore:ensure_first_param
enable => true,
unit => {
'Description' => 'Obmondo borg backup',
},
timer => {
'OnCalendar' => systemd_make_timespec($timespec),
'RandomizedDelaySec' => $randomized_delay,
'Persistent' => 'true', # lint:ignore:quoted_booleans
},
install => {
'WantedBy' => 'timers.target',
},
},
},
check_host => undef,
}
}