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
|
# File 'manifests/init.pp', line 19
class dbbackup (
Optional[Integer[1]] $pigz_cpu_cores = undef,
Stdlib::Absolutepath $destination = '/mnt/dumps',
String[2] $interval = '1h',
Optional[Integer[1]] $backuphistory = undef,
Boolean $cleanup_empty_backup_dirs = true,
Array[String[1]] $dependencies = ['pigz'],
Boolean $manage_dependencies = false,
) {
file { '/usr/local/bin/dump_databases':
content => epp("${module_name}/dump_databases.epp", {
'destination' => $destination,
'pigz_cpu_cores' => $pigz_cpu_cores,
}),
owner => 'root',
group => 'root',
mode => '0755',
}
-> systemd::timer { 'dump_databases.timer':
enable => true,
active => true,
timer_content => epp("${module_name}/dump_databases.timer.epp", {
'interval' => $interval,
}),
service_content => epp("${module_name}/dump_databases.service.epp", {
'backuphistory' => $backuphistory,
'destination' => $destination,
'cleanup_empty_backup_dirs' => $cleanup_empty_backup_dirs,
}),
}
if $manage_dependencies {
$dependencies.each |String[1] $package| {
package { $package:
ensure => 'installed',
before => Systemd::Timer['dump_databases.timer'],
}
}
}
}
|