X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=modules%2Fbacula%2Fmanifests%2Fstorage%2Fclient.pp;h=12573008eeab1e16134a1edcc432d3ed7659ea23;hb=51c79070603003701cef47513835b6d3e41e64fc;hp=3b03a7598d19f057fc995978b3f9c005f762d8eb;hpb=e09b1d7607ce74df99e1324e405c2877d09bee79;p=mirror%2Fdsa-puppet.git diff --git a/modules/bacula/manifests/storage/client.pp b/modules/bacula/manifests/storage/client.pp index 3b03a7598..12573008e 100644 --- a/modules/bacula/manifests/storage/client.pp +++ b/modules/bacula/manifests/storage/client.pp @@ -2,12 +2,28 @@ # # This is stored config by a client and then collected on the storage # -# @param client The name of the client (relevant for device names, media type names, etc.) +# @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 $client = $name + String $director_server, + 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 + $device_name = "${bacula::storage::filestor_device}-${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'), @@ -15,12 +31,25 @@ define bacula::storage::client( group => bacula, notify => Exec['bacula-sd restart-when-idle'], ; - "${bacula::storage::backup_path}/${client}": + $directory: ensure => directory, mode => '0755', owner => bacula, group => bacula, ; } -} + # enable the director to make (client, storage) specific configuration + @@bacula::director::client_from_storage { $client: + tag => "bacula::to-director::${director_server}", + client => $client, + storage_address => $bacula::storage::storage_address, + port_sd => $bacula::storage::port_sd, + 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, + } +}