/
client.pp
91 lines (83 loc) · 3.31 KB
/
client.pp
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# This class installs and configures the File Daemon to backup a client system.
#
# @param port The listening port for the File Daemon
# @param listen_address The listening INET or INET6 address for File Daemon
# @param password A password to use for communication with this File Daemon
# @param max_concurrent_jobs Bacula FD option for 'Maximum Concurrent Jobs'
# @param packages A list of packages to install; loaded from hiera
# @param services A list of services to operate; loaded from hiera
# @param director_name The hostname of the director for this FD
# @param autoprune Bacula FD option for 'AutoPrune'
# @param file_retention Bacula FD option for 'File Retention'
# @param job_retention Bacula FD option for 'Job Retention'
# @param client The name or address by which to contact this FD
# @param default_pool The name of the Pool for this FD to use by default
# @param default_pool_full The name of the Pool to use for Full jobs
# @param default_pool_inc The name of the Pool to use for Incremental jobs
# @param default_pool_diff The name of the Pool to use for Differential jobs
#
# @example
# class { 'bacula::client': director_name => 'mydirector.example.com' }
#
class bacula::client (
String $packages,
String $services,
String $default_pool,
Optional[String] $default_pool_full,
Optional[String] $default_pool_inc,
Optional[String] $default_pool_diff,
Integer $port = 9102,
Stdlib::Ip_address $listen_address = $facts['ipaddress'],
String $password = 'secret',
Integer $max_concurrent_jobs = 2,
String $director_name = $bacula::director_name,
Boolean $autoprune = true,
Bacula::Time $file_retention = '45 days',
Bacula::Time $job_retention = '6 months',
String $client = $trusted['certname'],
String $address = $facts['fqdn'],
Optional[Boolean] $pki_signatures = undef,
Optional[Boolean] $pki_encryption = undef,
Optional[String] $pki_keypair = undef,
Optional[String] $pki_master_key = undef,
) inherits bacula {
$group = $::bacula::bacula_group
$conf_dir = $::bacula::conf_dir
$config_file = "${conf_dir}/bacula-fd.conf"
package { $packages:
ensure => present,
}
service { $services:
ensure => running,
enable => true,
require => Package[$packages],
}
$use_pki = ($pki_signatures or $pki_encryption) and $pki_keypair
concat { $config_file:
owner => 'root',
group => $group,
mode => '0640',
show_diff => false,
require => Package[$packages],
notify => Service[$services],
}
concat::fragment { 'bacula-client-header':
target => $config_file,
content => template('bacula/bacula-fd-header.erb'),
}
bacula::messages { 'Standard-fd':
daemon => 'fd',
director => "${director_name}-dir = all, !skipped, !restored",
append => '"/var/log/bacula/bacula-fd.log" = all, !skipped',
}
# Tell the director about this client config
@@bacula::director::client { $client:
address => $address,
port => $port,
password => $password,
autoprune => $autoprune,
file_retention => $file_retention,
job_retention => $job_retention,
tag => "bacula-${director_name}",
}
}