Split the director config coming from each node in two parts: one that comes from...
[mirror/dsa-puppet.git] / modules / bacula / manifests / storage / client.pp
index 3b03a75..71d8731 100644 (file)
@@ -2,12 +2,18 @@
 #
 # 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 The director for this client
+# @param client          The name of the client (relevant for device names, media type names, etc.)
 define bacula::storage::client(
+  String $director_server,
   String $client = $name
 ) {
   include bacula::storage
 
+  $device_name     = "${bacula::storage::filestor_device}-${client}"
+  $media_type_name = "${bacula::storage::filestor_name}-${client}"
+  $directory       = "${bacula::storage::backup_path}/${client}"
+
   file {
     "/etc/bacula/storage-conf.d/${client}.conf":
       content => template('bacula/storage/sd-per-client.conf.erb'),
@@ -15,12 +21,21 @@ 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 { $::fqdn:
+    tag                     => "bacula::to-director::${director_server}",
+    storage_address         => $::fqdn,
+    port_sd                 => $bacula::storage::port_sd,
+    storage_secret          => $bacula::storage::storage_secret,
+    storage_device_name     => $device_name,
+    storage_media_type_name => $media_type_name,
+  }
+}