4990c1175432437c57c2485435df26eab9c6f936
[mirror/dsa-puppet.git] / modules / bacula / manifests / client / director.pp
1 # Bacula fd config: director snippet
2 #
3 # Each/The director exports this class to be collected by each fd.
4 #
5 # @param director_name     bacula name of the dir instance
6 # @param director_address  address of this dir instance that other instances should connect to (dns name)
7 define bacula::client::director(
8   String $director_name,
9   Stdlib::Host $director_address,
10 ) {
11   include bacula::client
12
13   $dir_client_secret = hkdf('/etc/puppet/secret', "bacula::director<->fd::${director_address}<->${::fqdn}")
14
15   @@bacula::director::client { $bacula::client::client:
16     port_fd       => $bacula::client::port_fd,
17     client        => $bacula::client::client,
18     client_name   => $bacula::client::client_name,
19     client_secret => $dir_client_secret,
20     tag           => "bacula::to-director::${director_address}",
21   }
22
23   file {
24     "/etc/bacula/fd-conf.d/Dir_${director_address}.conf":
25       content => template('bacula/client/fd-per-director.conf.erb'),
26       mode    => '0440',
27       group   => bacula,
28       notify  => Exec['bacula-fd restart-when-idle'],
29       ;
30   }
31 }