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 The director server that controls this client's backups
7 # @param storage_server The storage server to use for this client
8 # @param port_fd Port that bacula-fd listens on
9 # @param ensure present or absent
11 String $director_server,
12 String $storage_server,
13 Integer $port_fd = 9102,
14 Enum['present', 'absent'] $ensure = defined(Class['bacula::not_a_client']) ? { true => 'absent', default => 'present' },
16 $package_ensure = $ensure ? { 'present' => 'installed', 'absent' => 'purged' }
17 $service_ensure = $ensure ? { 'present' => 'running', 'absent' => 'stopped' }
18 $service_enable = $ensure ? { 'present' => true, 'absent' => false }
19 $reverse_ensure = $ensure ? { 'present' => 'absent', 'absent' => 'present' }
21 if $ensure == 'present' {
22 @@bacula::storage::client { $::fqdn:
23 tag => "bacula::to-storage::${storage_server}"
26 @@bacula::director::client { $::fqdn:
28 tag => "bacula::to-director::${director_server}"
31 @@concat::fragment { "bacula-dsa-client-list::${::fqdn}":
32 target => $bacula::bacula_dsa_client_list ,
36 tag => $bacula::tag_bacula_dsa_client_list,
39 # allow access from director
40 Ferm::Rule::Simple <<| tag == "bacula::director-to-fd::${bacula::bacula_director_address}" |>> {
44 # get access to the storage
45 @@ferm::rule::simple { "bacula::fd-to-storage::${::fqdn}":
46 tag => "bacula::fd-to-storage::${bacula::bacula_storage_address}",
47 description => 'Allow bacula-fd access to the bacula-storage',
49 saddr => $bacula::public_addresses,
51 } elsif $ensure == 'absent' {
64 ensure => $package_ensure
67 service { 'bacula-fd':
68 ensure => $service_ensure,
69 enable => $service_enable,
71 require => Package['bacula-fd']
74 exec { 'bacula-fd restart-when-idle':
75 path => '/usr/bin:/usr/sbin:/bin:/sbin',
76 command => "sh -c 'setsid /usr/local/sbin/bacula-idle-restart ${port_fd} bacula-fd &'",
78 subscribe => [ File[$bacula::bacula_ssl_server_cert], File[$bacula::bacula_ssl_client_cert] ],
79 require => File['/usr/local/sbin/bacula-idle-restart'],
82 file { '/etc/bacula/bacula-fd.conf':
84 content => template('bacula/bacula-fd.conf.erb'),
88 require => Package['bacula-fd'],
89 notify => Exec['bacula-fd restart-when-idle'],
91 file { '/usr/local/sbin/bacula-backup-dirs':
94 source => 'puppet:///modules/bacula/bacula-backup-dirs',
96 file { '/usr/local/sbin/postbaculajob':
99 source => 'puppet:///modules/bacula/postbaculajob',
101 file { '/etc/default/bacula-fd':
103 content => template('bacula/default.bacula-fd.erb'),
107 require => Package['bacula-fd'],
108 notify => Service['bacula-fd'],
110 if (versioncmp($::lsbmajdistrelease, '9') >= 0 and $facts['systemd']) {
111 dsa_systemd::override { 'bacula-fd':
115 ExecStart=/usr/sbin/bacula-fd -c $CONFIG -f -u bacula -k
119 dsa_systemd::override { 'bacula-fd':