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' }
22 $directory_ensure = $ensure ? { 'present' => 'directory', 'absent' => 'absent' }
26 file { '/etc/bacula/fd-conf.d':
27 ensure => $directory_ensure,
33 notify => Exec['bacula-fd restart-when-idle'],
36 if $ensure == 'present' {
37 Bacula::Client::Director <<| tag == "bacula::to-fd::${director_server}" |>> {
38 before => Exec['bacula-fd restart-when-idle'],
41 @@bacula::storage::client { $client:
42 tag => "bacula::to-storage::${storage_server}",
44 director_server => $director_server,
47 @@concat::fragment { "bacula-dsa-client-list::${client}":
48 target => $bacula::bacula_dsa_client_list ,
52 tag => $bacula::tag_bacula_dsa_client_list,
55 # allow access from director
56 Ferm::Rule::Simple <<| tag == "bacula::director-to-fd::${director_server}" |>> {
60 # get access to the storage
61 @@ferm::rule::simple { "bacula::fd-to-storage::${client}":
62 tag => "bacula::fd-to-storage::${storage_server}",
63 description => 'Allow bacula-fd access to the bacula-storage',
65 saddr => $bacula::public_addresses,
67 } elsif $ensure == 'absent' {
80 ensure => $package_ensure
83 service { 'bacula-fd':
84 ensure => $service_ensure,
85 enable => $service_enable,
89 exec { 'bacula-fd restart-when-idle':
90 path => '/usr/bin:/usr/sbin:/bin:/sbin',
91 command => "sh -c 'setsid /usr/local/sbin/bacula-idle-restart ${port_fd} bacula-fd &'",
93 subscribe => [ File[$bacula::bacula_ssl_server_cert], File[$bacula::bacula_ssl_client_cert] ],
94 require => [ File['/usr/local/sbin/bacula-idle-restart'], File['/etc/bacula/fd-conf.d/empty.conf'] ],
97 file { '/etc/bacula/bacula-fd.conf':
99 content => template('bacula/bacula-fd.conf.erb'),
103 notify => Exec['bacula-fd restart-when-idle'],
105 file { '/etc/bacula/fd-conf.d/empty.conf':
110 notify => Exec['bacula-fd restart-when-idle'],
112 file { '/usr/local/sbin/bacula-backup-dirs':
115 source => 'puppet:///modules/bacula/bacula-backup-dirs',
117 file { '/usr/local/sbin/postbaculajob':
120 source => 'puppet:///modules/bacula/postbaculajob',
122 file { '/etc/default/bacula-fd':
124 content => template('bacula/default.bacula-fd.erb'),
128 notify => Service['bacula-fd'],
130 if (versioncmp($::lsbmajdistrelease, '9') >= 0 and $facts['systemd']) {
131 dsa_systemd::override { 'bacula-fd':
135 ExecStart=/usr/sbin/bacula-fd -c $CONFIG -f -u bacula -k
139 dsa_systemd::override { 'bacula-fd':