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 storage_server The storage server to use for this client
7 # @param port_fd Port that bacula-fd listens on
8 # @param ensure present or absent
10 String $storage_server,
11 Integer $port_fd = 9102,
12 Enum['present', 'absent'] $ensure = defined(Class['bacula::not_a_client']) ? { true => 'absent', default => 'present' },
14 $package_ensure = $ensure ? { 'present' => 'installed', 'absent' => 'purged' }
15 $service_ensure = $ensure ? { 'present' => 'running', 'absent' => 'stopped' }
16 $service_enable = $ensure ? { 'present' => true, 'absent' => false }
17 $reverse_ensure = $ensure ? { 'present' => 'absent', 'absent' => 'present' }
19 if $ensure == 'present' {
20 @@bacula::storage::client { $::fqdn:
21 tag => "bacula::to-storage::${storage_server}"
24 @@bacula::node { $::fqdn:
28 @@concat::fragment { "bacula-dsa-client-list::${::fqdn}":
29 target => $bacula::bacula_dsa_client_list ,
33 tag => $bacula::tag_bacula_dsa_client_list,
36 # allow access from director
37 Ferm::Rule::Simple <<| tag == "bacula::director-to-fd::${bacula::bacula_director_address}" |>> {
41 # get access to the storage
42 @@ferm::rule::simple { "bacula::fd-to-storage::${::fqdn}":
43 tag => "bacula::fd-to-storage::${bacula::bacula_storage_address}",
44 description => 'Allow bacula-fd access to the bacula-storage',
46 saddr => $bacula::public_addresses,
48 } elsif $ensure == 'absent' {
61 ensure => $package_ensure
64 service { 'bacula-fd':
65 ensure => $service_ensure,
66 enable => $service_enable,
68 require => Package['bacula-fd']
71 exec { 'bacula-fd restart-when-idle':
72 path => '/usr/bin:/usr/sbin:/bin:/sbin',
73 command => "sh -c 'setsid /usr/local/sbin/bacula-idle-restart ${port_fd} bacula-fd &'",
75 subscribe => [ File[$bacula::bacula_ssl_server_cert], File[$bacula::bacula_ssl_client_cert] ],
76 require => File['/usr/local/sbin/bacula-idle-restart'],
79 file { '/etc/bacula/bacula-fd.conf':
81 content => template('bacula/bacula-fd.conf.erb'),
85 require => Package['bacula-fd'],
86 notify => Exec['bacula-fd restart-when-idle'],
88 file { '/usr/local/sbin/bacula-backup-dirs':
91 source => 'puppet:///modules/bacula/bacula-backup-dirs',
93 file { '/usr/local/sbin/postbaculajob':
96 source => 'puppet:///modules/bacula/postbaculajob',
98 file { '/etc/default/bacula-fd':
100 content => template('bacula/default.bacula-fd.erb'),
104 require => Package['bacula-fd'],
105 notify => Service['bacula-fd'],
107 if (versioncmp($::lsbmajdistrelease, '9') >= 0 and $facts['systemd']) {
108 dsa_systemd::override { 'bacula-fd':
112 ExecStart=/usr/sbin/bacula-fd -c $CONFIG -f -u bacula -k
116 dsa_systemd::override { 'bacula-fd':