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 Enum['present', 'absent'] $ensure = getfromhash($site::nodeinfo, 'not-bacula-client') ? { true => 'absent', default => 'present' },
7 # Enum['present', 'absent'] $ensure = defined(Class["bacula::not_a_client"]) ? { true => 'absent', default => 'present' },
9 $package_ensure = $ensure ? { 'present' => 'installed', 'absent' => 'purged' }
10 $service_ensure = $ensure ? { 'present' => 'running', 'absent' => 'stopped' }
11 $service_enable = $ensure ? { 'present' => true, 'absent' => false }
12 $reverse_ensure = $ensure ? { 'present' => 'absent', 'absent' => 'present' }
14 if $ensure == 'present' {
15 @@bacula::storage_per_node { $::fqdn: }
17 @@bacula::node { $::fqdn:
18 bacula_client_port => $bacula::bacula_client_port,
21 @@concat::fragment { "bacula-dsa-client-list::$fqdn":
22 target => $bacula::bacula_dsa_client_list ,
26 tag => $bacula::tag_bacula_dsa_client_list,
28 } elsif $ensure == 'absent' {
37 package { ['bacula-fd', 'bacula-common']:
38 ensure => $package_ensure
41 service { 'bacula-fd':
42 ensure => $service_ensure,
43 enable => $service_enable,
45 require => Package['bacula-fd']
48 exec { 'bacula-fd restart-when-idle':
49 path => '/usr/bin:/usr/sbin:/bin:/sbin',
50 command => 'sh -c "setsid /usr/local/sbin/bacula-idle-restart fd &"',
52 subscribe => [ File[$bacula_ssl_server_cert], File[$bacula_ssl_client_cert] ],
53 require => File['/usr/local/sbin/bacula-idle-restart'],
56 file { '/etc/bacula/bacula-fd.conf':
58 content => template('bacula/bacula-fd.conf.erb'),
62 require => Package['bacula-fd'],
63 notify => Exec['bacula-fd restart-when-idle'],
65 file { '/usr/local/sbin/bacula-backup-dirs':
68 source => 'puppet:///modules/bacula/bacula-backup-dirs',
70 file { '/usr/local/sbin/postbaculajob':
73 source => 'puppet:///modules/bacula/postbaculajob',
75 file { '/etc/default/bacula-fd':
77 content => template('bacula/default.bacula-fd.erb'),
81 require => Package['bacula-fd'],
82 notify => Service['bacula-fd'],
84 if (versioncmp($::lsbmajdistrelease, '9') >= 0 and $systemd) {
85 dsa_systemd::override { 'bacula-fd':
89 ExecStart=/usr/sbin/bacula-fd -c $CONFIG -f -u bacula -k
93 dsa_systemd::override { 'bacula-fd':
98 ferm::rule { 'dsa-bacula-fd':
100 description => 'Allow bacula access from storage and director',
101 rule => "proto tcp mod state state (NEW) dport (${bacula_client_port}) saddr (${bacula_director_ip_addrs}) ACCEPT",