1 # our bacula client configuration
3 # this mostly configures the file daemon, but also firewall rules and
4 # fragments to sent to the other servers.
6 # @param director_server director server (address) that controls this client's backups
7 # @param storage_server storage server (address) to use for this client
8 # @param port_fd port that bacula-fd listens on
9 # @param client_name bacula client name for this instance
10 # @param ensure present or absent
11 # @param volume_retention_full how long to keep volumes with full backups
12 # @param volume_retention_diff how long to keep volumes with differential backups
13 # @param volume_retention_inc how long to keep volumes with incremental backups
14 # @param file_retention how long to keep information about which files are in which volumes/jobs
15 # @param job_retention how long to keep job records
17 Stdlib::Host $director_server,
18 Stdlib::Host $storage_server,
19 Integer $port_fd = 9102,
20 String $client_name = "${::fqdn}-fd",
21 Enum['present', 'absent'] $ensure = defined(Class['bacula::not_a_client']) ? { true => 'absent', default => 'present' },
22 String $volume_retention_full = '100 days',
23 String $volume_retention_diff = '50 days',
24 String $volume_retention_inc = '30 days',
25 String $file_retention = '30 days',
26 String $job_retention = $volume_retention_full,
28 $package_ensure = $ensure ? { 'present' => 'installed', 'absent' => 'purged' }
29 $service_ensure = $ensure ? { 'present' => 'running', 'absent' => 'stopped' }
30 $service_enable = $ensure ? { 'present' => true, 'absent' => false }
31 $reverse_ensure = $ensure ? { 'present' => 'absent', 'absent' => 'present' }
32 $directory_ensure = $ensure ? { 'present' => 'directory', 'absent' => 'absent' }
36 file { '/etc/bacula/fd-conf.d':
37 ensure => $directory_ensure,
43 notify => Exec['bacula-fd restart-when-idle'],
46 if $ensure == 'present' {
47 Bacula::Client::Director <<| tag == "bacula::to-fd::${director_server}" |>> {
48 before => Exec['bacula-fd restart-when-idle'],
51 @@bacula::storage::client { $client:
52 tag => "bacula::to-storage::${storage_server}",
54 director_server => $director_server,
55 volume_retention_full => $volume_retention_full,
56 volume_retention_diff => $volume_retention_diff,
57 volume_retention_inc => $volume_retention_inc,
60 @@concat::fragment { "bacula-dsa-client-list::${client}":
61 target => $bacula::bacula_dsa_client_list ,
65 tag => $bacula::tag_bacula_dsa_client_list,
68 # allow access from director
69 Ferm::Rule::Simple <<| tag == "bacula::director-to-fd::${director_server}" |>> {
73 # get access to the storage
74 @@ferm::rule::simple { "bacula::fd-to-storage::${client}":
75 tag => "bacula::fd-to-storage::${storage_server}",
76 description => 'Allow bacula-fd access to the bacula-storage',
78 saddr => $bacula::public_addresses,
80 } elsif $ensure == 'absent' {
93 ensure => $package_ensure
96 service { 'bacula-fd':
97 ensure => $service_ensure,
98 enable => $service_enable,
101 dsa_systemd::override { 'bacula-fd':
105 After=unbound.service
108 ExecStart=/usr/sbin/bacula-fd -c $CONFIG -f -u bacula -k
112 exec { 'bacula-fd restart-when-idle':
113 path => '/usr/bin:/usr/sbin:/bin:/sbin',
114 command => "sh -c 'setsid /usr/local/sbin/bacula-idle-restart ${port_fd} bacula-fd &'",
116 subscribe => [ File[$bacula::bacula_ssl_server_cert], File[$bacula::bacula_ssl_client_cert] ],
117 require => [ File['/usr/local/sbin/bacula-idle-restart'], File['/etc/bacula/fd-conf.d/empty.conf'] ],
120 file { '/etc/bacula/bacula-fd.conf':
122 content => template('bacula/bacula-fd.conf.erb'),
126 notify => Exec['bacula-fd restart-when-idle'],
128 file { '/etc/bacula/fd-conf.d/empty.conf':
133 notify => Exec['bacula-fd restart-when-idle'],
135 file { '/usr/local/sbin/bacula-backup-dirs':
138 source => 'puppet:///modules/bacula/bacula-backup-dirs',
140 file { '/usr/local/sbin/postbaculajob':
143 source => 'puppet:///modules/bacula/postbaculajob',
145 file { '/etc/default/bacula-fd':
147 content => template('bacula/default.bacula-fd.erb'),
151 notify => Service['bacula-fd'],