Only realize the director-from-client config if the director-from-client-via-storage...
[mirror/dsa-puppet.git] / modules / bacula / manifests / director / client.pp
1 # Bacula client config on the director
2 #
3 # This is stored config by a client, collected on the director
4 #
5 # @param port_fd         port that this node's bacula-fd is listening on
6 # @param client          name of the client (relevant for device names, media type names, etc.)
7 # @param client_name     bacula client name
8 # @param client_secret   shared secret between director and client
9 # @param file_retention  how long to keep information about which files are in which volumes/jobs
10 # @param job_retention   how long to keep job records
11 define bacula::director::client (
12   Integer $port_fd,
13   Stdlib::Host $client = $name,
14   String $client_name,
15   String $client_secret,
16   String $file_retention = '30 days', # XXX remove defaults
17   String $job_retention = '100 days', # XXX remove defaults
18 ) {
19   include bacula::director
20
21   # we define this in both bacula::director::client_from_storage and
22   # bacula::director::client and it needs to match.
23   $pool_name     = "${bacula::director::pool_name}-${client}"
24
25   if defined(File["/etc/bacula/conf.d/${client}_storage.conf"]) {
26     # this config is only valid if the pools defined in ${client}_storage exist.
27     file { "/etc/bacula/conf.d/${client}.conf":
28       content => template('bacula/director/dir-per-client.erb'),
29       mode    => '0440',
30       group   => bacula,
31       notify  => Exec['bacula-director reload']
32     }
33   }
34 }
35