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 port_fd Port that bacula-fd listens on
7 # @param ensure present or absent
9 Integer $port_fd = 9102,
10 Enum['present', 'absent'] $ensure = defined(Class['bacula::not_a_client']) ? { true => 'absent', default => 'present' },
12 $package_ensure = $ensure ? { 'present' => 'installed', 'absent' => 'purged' }
13 $service_ensure = $ensure ? { 'present' => 'running', 'absent' => 'stopped' }
14 $service_enable = $ensure ? { 'present' => true, 'absent' => false }
15 $reverse_ensure = $ensure ? { 'present' => 'absent', 'absent' => 'present' }
17 if $ensure == 'present' {
18 @@bacula::storage_per_node { $::fqdn: }
20 @@bacula::node { $::fqdn:
24 @@concat::fragment { "bacula-dsa-client-list::${::fqdn}":
25 target => $bacula::bacula_dsa_client_list ,
29 tag => $bacula::tag_bacula_dsa_client_list,
32 # allow access from director
33 Ferm::Rule::Simple <<| tag == "bacula::director-to-fd::${bacula::bacula_director_address}" |>> {
37 # get access to the storage
38 @@ferm::rule::simple { "bacula::fd-to-storage::${::fqdn}":
39 tag => "bacula::fd-to-storage::${bacula::bacula_storage_address}",
40 description => 'Allow bacula-fd access to the bacula-storage',
42 saddr => $bacula::public_addresses,
44 } elsif $ensure == 'absent' {
57 ensure => $package_ensure
60 service { 'bacula-fd':
61 ensure => $service_ensure,
62 enable => $service_enable,
64 require => Package['bacula-fd']
67 exec { 'bacula-fd restart-when-idle':
68 path => '/usr/bin:/usr/sbin:/bin:/sbin',
69 command => "sh -c 'setsid /usr/local/sbin/bacula-idle-restart ${port_fd} bacula-fd &'",
71 subscribe => [ File[$bacula::bacula_ssl_server_cert], File[$bacula::bacula_ssl_client_cert] ],
72 require => File['/usr/local/sbin/bacula-idle-restart'],
75 file { '/etc/bacula/bacula-fd.conf':
77 content => template('bacula/bacula-fd.conf.erb'),
81 require => Package['bacula-fd'],
82 notify => Exec['bacula-fd restart-when-idle'],
84 file { '/usr/local/sbin/bacula-backup-dirs':
87 source => 'puppet:///modules/bacula/bacula-backup-dirs',
89 file { '/usr/local/sbin/postbaculajob':
92 source => 'puppet:///modules/bacula/postbaculajob',
94 file { '/etc/default/bacula-fd':
96 content => template('bacula/default.bacula-fd.erb'),
100 require => Package['bacula-fd'],
101 notify => Service['bacula-fd'],
103 if (versioncmp($::lsbmajdistrelease, '9') >= 0 and $facts['systemd']) {
104 dsa_systemd::override { 'bacula-fd':
108 ExecStart=/usr/sbin/bacula-fd -c $CONFIG -f -u bacula -k
112 dsa_systemd::override { 'bacula-fd':