Make rentention periods configurable with hiera, per client
[mirror/dsa-puppet.git] / modules / bacula / manifests / storage / client.pp
index ba2f930..1257300 100644 (file)
@@ -4,9 +4,15 @@
 #
 # @param director_server  director for this client
 # @param client           name/address of the client (relevant for device names, media type names, etc.)
+# @param volume_retention_full  how long to keep volumes with full backups
+# @param volume_retention_diff  how long to keep volumes with differential backups
+# @param volume_retention_inc   how long to keep volumes with incremental backups
 define bacula::storage::client(
   String $director_server,
-  Stdlib::Host $client = $name
+  Stdlib::Host $client = $name,
+  String $volume_retention_full = '100 days', # XXX remove defaults
+  String $volume_retention_diff = '50 days', # XXX remove defaults
+  String $volume_retention_inc  = '30 days', # XXX remove defaults
 ) {
   include bacula::storage
 
@@ -14,6 +20,10 @@ define bacula::storage::client(
   $media_type_name = "${bacula::storage::filestor_name}-${client}"
   $directory       = "${bacula::storage::backup_path}/${client}"
 
+  # this is created in both bacula::storage::client and
+  # bacula::storage::director and needs to be the same
+  $dir_storage_secret = hkdf('/etc/puppet/secret', "bacula::director<->storage::${director_server}<->${::fqdn}")
+
   file {
     "/etc/bacula/storage-conf.d/${client}.conf":
       content => template('bacula/storage/sd-per-client.conf.erb'),
@@ -35,8 +45,11 @@ define bacula::storage::client(
     client                  => $client,
     storage_address         => $bacula::storage::storage_address,
     port_sd                 => $bacula::storage::port_sd,
-    storage_secret          => $bacula::storage::storage_secret,
+    storage_secret          => $dir_storage_secret,
     storage_device_name     => $device_name,
     storage_media_type_name => $media_type_name,
+    volume_retention_full   => $volume_retention_full,
+    volume_retention_diff   => $volume_retention_diff,
+    volume_retention_inc    => $volume_retention_inc,
   }
 }