76b0947b9558e796266d054dd353578f03d04969
[mirror/dsa-puppet.git] / modules / bacula / manifests / director / client.pp
1 # Bacula client config on the director
2 #
3 # This is stored config by a client, collected on the director
4 #
5 # @param port_fd   port that this node's bacula-fd is listening on
6 # @param client The name of the client (relevant for device names, media type names, etc.)
7 define bacula::director::client (
8   Integer $port_fd = 9102,
9   String $client = $name,
10 ) {
11   include bacula
12
13   $bacula_pool_name         = $bacula::bacula_pool_name
14   $bacula_filestor_name     = $bacula::bacula_filestor_name
15   $bacula_filestor_device   = $bacula::bacula_filestor_device
16   $bacula_storage_address   = $bacula::bacula_storage_address
17   $bacula_storage_port      = $bacula::bacula_storage_port
18   $bacula_storage_secret    = $bacula::bacula_storage_secret
19
20   $bacula_ca_path       = $bacula::bacula_ca_path
21   $bacula_ssl_client_cert = $bacula::bacula_ssl_client_cert
22   $bacula_ssl_client_key  = $bacula::bacula_ssl_client_key
23
24   $bacula_client_name   = "${client}-fd"
25   $bacula_client_secret = hkdf('/etc/puppet/secret', "bacula-fd-${client}")
26
27   file { "/etc/bacula/conf.d/${client}.conf":
28     content => template('bacula/director/dir-per-client.erb'),
29     mode    => '0440',
30     group   => bacula,
31     notify  => Exec['bacula-director reload']
32   }
33
34   file { "/etc/bacula/storages-list.d/${client}.storage":
35     content => "${bacula::bacula_filestor_name}-${client}\n",
36     mode    => '0440',
37     group   => bacula,
38     notify  => Exec['bacula-director reload']
39   }
40 }
41