s/bacula_ca_path/bacula_ssl_ca_path/
[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 # @param volume_retention_full  how long to keep volumes with full backups
13 # @param volume_retention_diff  how long to keep volumes with differential backups
14 # @param volume_retention_inc   how long to keep volumes with incremental backups
15 define bacula::director::client_from_storage (
16   Stdlib::Host $storage_address,
17   Integer $port_sd,
18   String $storage_secret,
19   String $storage_device_name,
20   String $storage_media_type_name,
21   String $volume_retention_full = '100 days', # XXX remove defaults
22   String $volume_retention_diff = '50 days', # XXX remove defaults
23   String $volume_retention_inc  = '30 days', # XXX remove defaults
24
25   Stdlib::Host $client = $name,
26 ) {
27   include bacula::director
28
29   $bacula_ssl_ca_path     = $bacula::bacula_ssl_ca_path
30   $bacula_ssl_client_cert = $bacula::bacula_ssl_client_cert
31   $bacula_ssl_client_key  = $bacula::bacula_ssl_client_key
32
33   # For historical reasons, we use the same string for
34   # director-internal storage name as we do for mediate
35   # type names.  If we ever blow away the catalog and start
36   # again, we should probably pick a different string here
37   # (or there).
38   $storage_name  = $storage_media_type_name
39
40   # we define this in both bacula::director::client_from_storage and
41   # bacula::director::client and it needs to match.
42   $pool_name     = "${bacula::director::pool_name}-${client}"
43
44   file { "/etc/bacula/conf.d/${client}_storage.conf":
45     content => template('bacula/director/dir-per-client-from-storage.erb'),
46     mode    => '0440',
47     group   => bacula,
48     notify  => Exec['bacula-director reload']
49   }
50
51   file { "/etc/bacula/storages-list.d/${client}.storage":
52     content => "${storage_name}\n",
53     mode    => '0440',
54     group   => bacula,
55     notify  => Exec['bacula-director reload']
56   }
57 }
58