Split the director config coming from each node in two parts: one that comes from...
[mirror/dsa-puppet.git] / modules / bacula / manifests / storage / client.pp
1 # Bacula storage configuration for a client.
2 #
3 # This is stored config by a client and then collected on the storage
4 #
5 # @param director_server The director for this client
6 # @param client          The name of the client (relevant for device names, media type names, etc.)
7 define bacula::storage::client(
8   String $director_server,
9   String $client = $name
10 ) {
11   include bacula::storage
12
13   $device_name     = "${bacula::storage::filestor_device}-${client}"
14   $media_type_name = "${bacula::storage::filestor_name}-${client}"
15   $directory       = "${bacula::storage::backup_path}/${client}"
16
17   file {
18     "/etc/bacula/storage-conf.d/${client}.conf":
19       content => template('bacula/storage/sd-per-client.conf.erb'),
20       mode    => '0440',
21       group   => bacula,
22       notify  => Exec['bacula-sd restart-when-idle'],
23       ;
24     $directory:
25       ensure => directory,
26       mode   => '0755',
27       owner  => bacula,
28       group  => bacula,
29       ;
30   }
31
32   # enable the director to make (client, storage) specific configuration
33   @@bacula::director::client_from_storage { $::fqdn:
34     tag                     => "bacula::to-director::${director_server}",
35     storage_address         => $::fqdn,
36     port_sd                 => $bacula::storage::port_sd,
37     storage_secret          => $bacula::storage::storage_secret,
38     storage_device_name     => $device_name,
39     storage_media_type_name => $media_type_name,
40   }
41 }