simplify email_error default logic
[mirror/dsa-puppet.git] / modules / bacula / manifests / init.pp
1 # bacula class -- defines all the variables we care about in our bacula deployment
2 #
3 # @param ssl_ca_path      full path and filename specifying a PEM encoded TLS CA certificate(s)
4 # @param ssl_client_cert  path to TLS client certificate
5 # @param ssl_client_key   path to TLS client certificate key
6 # @param ssl_server_cert  path to TLS server certificate
7 # @param ssl_server_key   path to TLS server certificate key
8 # @param email_all        email address for all reports
9 # @param email_error      email address for errors
10 # @param email_operator   email address for the operator (to mount tapes etc)
11 # @param email_daemon     email address for messages from the daemon
12 # @param public_addresses this host's public IP addresses.  The ones it connects out from and is reachable from outsite.
13 # @param has_ipv4         daemons should listen on ipv4
14 # @param has_ipv6         daemons should listen on ipv6
15 class bacula (
16   String $ssl_ca_path,
17   String $ssl_client_cert,
18   String $ssl_client_key,
19   String $ssl_server_cert,
20   String $ssl_server_key,
21
22   Optional[String] $email_all = undef,
23   # default to all if defined, otherwise default to 'root' to enforce error delivery
24   String $email_error                          = $email_all ? { undef => 'root', default => $email_all },
25   String $email_operator                       = $email_error,
26   String $email_daemon                         = $email_error,
27   Array[Stdlib::IP::Address] $public_addresses = $base::public_addresses,
28   Boolean $has_ipv4                            = $bacula::public_addresses.any |$addr| { $addr =~ Stdlib::IP::Address::V4 },
29   Boolean $has_ipv6                            = $bacula::public_addresses.any |$addr| { $addr =~ Stdlib::IP::Address::V6 },
30 ) {
31   # This file is used by our helper scripts on the director
32   $bacula_dsa_client_list     = '/etc/bacula/dsa-clients'
33   $tag_bacula_dsa_client_list = 'bacula::dsa::clientlist'
34
35   $bacula_tls_ca_certificate_file = "TLS CA Certificate File = \"${ssl_ca_path}\""
36   $bacula_tls_client_certificate  = "TLS Certificate = \"${ssl_client_cert}\""
37   $bacula_tls_client_key          = "TLS Key = \"${ssl_client_key}\""
38   $bacula_tls_server_certificate  = "TLS Certificate = \"${ssl_server_cert}\""
39   $bacula_tls_server_key          = "TLS Key = \"${ssl_server_key}\""
40
41   file { '/usr/local/sbin/bacula-idle-restart':
42     mode   => '0555',
43     source => 'puppet:///modules/bacula/bacula-idle-restart',
44   }
45 }