aff2720886ed5849f2287134529dfa0f69ab9358
[mirror/dsa-puppet.git] / modules / bacula / manifests / director / client_from_storage.pp
1 # Bacula client config on the director
2 #
3 # This is stored config by a client, collected on the director
4 #
5 # @param client The name of the client (relevant for device names, media type names, etc.)
6 #
7 # @param storage_address         Address of the storage daemon
8 # @param port_sd                 Port of the storage daemon
9 # @param storage_secret          Shared secret between storage and director
10 # @param storage_device_name     Device name on the storage daemon for this node's backups
11 # @param storage_media_type_name Media type name on the storage daemon for this node's backupse
12 define bacula::director::client_from_storage (
13   Stdlib::Host $storage_address,
14   Integer $port_sd,
15   String $storage_secret,
16   String $storage_device_name,
17   String $storage_media_type_name,
18
19   Stdlib::Host $client = $name,
20 ) {
21   include bacula::director
22
23   $bacula_ca_path         = $bacula::bacula_ca_path
24   $bacula_ssl_client_cert = $bacula::bacula_ssl_client_cert
25   $bacula_ssl_client_key  = $bacula::bacula_ssl_client_key
26
27   # For historical reasons, we use the same string for
28   # director-internal storage name as we do for mediate
29   # type names.  If we ever blow away the catalog and start
30   # again, we should probably pick a different string here
31   # (or there).
32   $storage_name  = $storage_media_type_name
33
34   # we define this in both bacula::director::client_from_storage and
35   # bacula::director::client and it needs to match.
36   $pool_name     = "${bacula::director::pool_name}-${client}"
37
38   file { "/etc/bacula/conf.d/${client}_storage.conf":
39     content => template('bacula/director/dir-per-client-from-storage.erb'),
40     mode    => '0440',
41     group   => bacula,
42     notify  => Exec['bacula-director reload']
43   }
44
45   file { "/etc/bacula/storages-list.d/${client}.storage":
46     content => "${storage_name}\n",
47     mode    => '0440',
48     group   => bacula,
49     notify  => Exec['bacula-director reload']
50   }
51 }
52