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
12 Stdlib::Host $director_server,
13 Stdlib::Host $storage_server,
14 Integer $port_fd = 9102,
15 String $client_name = "${::fqdn}-fd",
16 Enum['present', 'absent'] $ensure = defined(Class['bacula::not_a_client']) ? { true => 'absent', default => 'present' },
18 $package_ensure = $ensure ? { 'present' => 'installed', 'absent' => 'purged' }
19 $service_ensure = $ensure ? { 'present' => 'running', 'absent' => 'stopped' }
20 $service_enable = $ensure ? { 'present' => true, 'absent' => false }
21 $reverse_ensure = $ensure ? { 'present' => 'absent', 'absent' => 'present' }
25 file { '/etc/bacula/fd-conf.d':
32 source => 'puppet:///files/empty/',
33 notify => Exec['bacula-fd restart-when-idle'],
36 if $ensure == 'present' {
37 Bacula::Client::Director <<| tag == "bacula::to-fd::${director_server}" |>>
39 @@bacula::storage::client { $client:
40 tag => "bacula::to-storage::${storage_server}",
42 director_server => $director_server,
45 @@concat::fragment { "bacula-dsa-client-list::${client}":
46 target => $bacula::bacula_dsa_client_list ,
50 tag => $bacula::tag_bacula_dsa_client_list,
53 # allow access from director
54 Ferm::Rule::Simple <<| tag == "bacula::director-to-fd::${director_server}" |>> {
58 # get access to the storage
59 @@ferm::rule::simple { "bacula::fd-to-storage::${client}":
60 tag => "bacula::fd-to-storage::${storage_server}",
61 description => 'Allow bacula-fd access to the bacula-storage',
63 saddr => $bacula::public_addresses,
65 } elsif $ensure == 'absent' {
78 ensure => $package_ensure
81 service { 'bacula-fd':
82 ensure => $service_ensure,
83 enable => $service_enable,
85 require => Package['bacula-fd']
88 exec { 'bacula-fd restart-when-idle':
89 path => '/usr/bin:/usr/sbin:/bin:/sbin',
90 command => "sh -c 'setsid /usr/local/sbin/bacula-idle-restart ${port_fd} bacula-fd &'",
92 subscribe => [ File[$bacula::bacula_ssl_server_cert], File[$bacula::bacula_ssl_client_cert] ],
93 require => File['/usr/local/sbin/bacula-idle-restart'],
96 file { '/etc/bacula/bacula-fd.conf':
98 content => template('bacula/bacula-fd.conf.erb'),
102 require => Package['bacula-fd'],
103 notify => Exec['bacula-fd restart-when-idle'],
105 file { '/usr/local/sbin/bacula-backup-dirs':
108 source => 'puppet:///modules/bacula/bacula-backup-dirs',
110 file { '/usr/local/sbin/postbaculajob':
113 source => 'puppet:///modules/bacula/postbaculajob',
115 file { '/etc/default/bacula-fd':
117 content => template('bacula/default.bacula-fd.erb'),
121 require => Package['bacula-fd'],
122 notify => Service['bacula-fd'],
124 if (versioncmp($::lsbmajdistrelease, '9') >= 0 and $facts['systemd']) {
125 dsa_systemd::override { 'bacula-fd':
129 ExecStart=/usr/sbin/bacula-fd -c $CONFIG -f -u bacula -k
133 dsa_systemd::override { 'bacula-fd':