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 tag => $bacula::tag_bacula_dsa_client_list,
62 target => $bacula::bacula_dsa_client_list,
66 # allow access from director
67 Ferm::Rule::Simple <<| tag == "bacula::director-to-fd::${director_server}" |>> {
71 # get access to the storage
72 @@ferm::rule::simple { "bacula::fd-to-storage::${client}":
73 tag => "bacula::fd-to-storage::${storage_server}",
74 description => 'Allow bacula-fd access to the bacula-storage',
76 saddr => $bacula::public_addresses,
78 } elsif $ensure == 'absent' {
91 ensure => $package_ensure
94 service { 'bacula-fd':
95 ensure => $service_ensure,
96 enable => $service_enable,
99 dsa_systemd::override { 'bacula-fd':
103 After=network-online.target unbound.service
106 ExecStart=/usr/sbin/bacula-fd -c $CONFIG -f -u bacula -k
110 exec { 'bacula-fd restart-when-idle':
111 path => '/usr/bin:/usr/sbin:/bin:/sbin',
112 command => "sh -c 'setsid /usr/local/sbin/bacula-idle-restart ${port_fd} bacula-fd &'",
114 subscribe => [ File[$bacula::ssl_server_cert], File[$bacula::ssl_client_cert] ],
115 require => [ File['/usr/local/sbin/bacula-idle-restart'], File['/etc/bacula/fd-conf.d/empty.conf'] ],
118 file { '/etc/bacula/bacula-fd.conf':
120 content => template('bacula/bacula-fd.conf.erb'),
124 notify => Exec['bacula-fd restart-when-idle'],
126 file { '/etc/bacula/fd-conf.d/empty.conf':
131 notify => Exec['bacula-fd restart-when-idle'],
133 file { '/usr/local/sbin/bacula-backup-dirs':
136 source => 'puppet:///modules/bacula/bacula-backup-dirs',
138 file { '/usr/local/sbin/postbaculajob':
141 source => 'puppet:///modules/bacula/postbaculajob',
143 file { '/etc/default/bacula-fd':
145 content => template('bacula/default.bacula-fd.erb'),
149 notify => Service['bacula-fd'],