7b4cb11b87dd8f04604d7bcbddb12b8cf6c35abe
[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   # For historical reasons, we use the same string for
30   # director-internal storage name as we do for mediate
31   # type names.  If we ever blow away the catalog and start
32   # again, we should probably pick a different string here
33   # (or there).
34   $storage_name  = $storage_media_type_name
35
36   # we define this in both bacula::director::client_from_storage and
37   # bacula::director::client and it needs to match.
38   $pool_name     = "${bacula::director::pool_name}-${client}"
39
40   file { "/etc/bacula/conf.d/${client}_storage.conf":
41     content => template('bacula/director/dir-per-client-from-storage.erb'),
42     mode    => '0440',
43     group   => bacula,
44     notify  => Exec['bacula-director reload']
45   }
46
47   file { "/etc/bacula/storages-list.d/${client}.storage":
48     content => "${storage_name}\n",
49     mode    => '0440',
50     group   => bacula,
51     notify  => Exec['bacula-director reload']
52   }
53 }
54