From: Peter Palfrader Date: Wed, 25 Sep 2019 16:21:30 +0000 (+0200) Subject: Split up mail roles X-Git-Url: https://git.adam-barratt.org.uk/?a=commitdiff_plain;h=3f2101f7122e86ccef1513263bd894eb801d4c24;p=mirror%2Fdsa-puppet.git Split up mail roles --- diff --git a/data/common.yaml b/data/common.yaml index 970397ae8..06f0d036d 100644 --- a/data/common.yaml +++ b/data/common.yaml @@ -32,7 +32,7 @@ roles::dns_primary::allow_access: - '2a01:3f0:0:28::25' # bacula # -bacula::operator_email: 'bacula-reports@admin.debian.org' +bacula::email_all: 'bacula-reports@admin.debian.org' bacula::ssl_ca_path: '/etc/ssl/debian/certs/ca.crt' bacula::ssl_client_cert: '/etc/ssl/debian/certs/thishost.crt' bacula::ssl_client_key: '/etc/ssl/private/thishost.key' diff --git a/modules/bacula/manifests/init.pp b/modules/bacula/manifests/init.pp index dfbc9ce33..90e42af87 100644 --- a/modules/bacula/manifests/init.pp +++ b/modules/bacula/manifests/init.pp @@ -5,7 +5,10 @@ # @param ssl_client_key path to TLS client certificate key # @param ssl_server_cert path to TLS server certificate # @param ssl_server_key path to TLS server certificate key -# @param operator_email email address for reports +# @param email_all email address for all reports +# @param email_error email address for errors +# @param email_operator email address for the operator (to mount tapes etc) +# @param email_daemon email address for messages from the daemon # @param public_addresses this host's public IP addresses. The ones it connects out from and is reachable from outsite. # @param has_ipv4 daemons should listen on ipv4 # @param has_ipv6 daemons should listen on ipv6 @@ -16,7 +19,10 @@ class bacula ( String $ssl_server_cert, String $ssl_server_key, - String $operator_email = 'root@localhost', + Optional[String] $email_all = undef, + String $email_error = $email_all ? { true => $email_all, default => 'root@localhost' }, + String $email_operator = $email_error, + String $email_daemon = $email_error, Array[Stdlib::IP::Address] $public_addresses = $base::public_addresses, Boolean $has_ipv4 = $bacula::public_addresses.any |$addr| { $addr =~ Stdlib::IP::Address::V4 }, Boolean $has_ipv6 = $bacula::public_addresses.any |$addr| { $addr =~ Stdlib::IP::Address::V6 }, diff --git a/modules/bacula/templates/bacula-dir.conf.erb b/modules/bacula/templates/bacula-dir.conf.erb index f714ea20c..b2a209335 100644 --- a/modules/bacula/templates/bacula-dir.conf.erb +++ b/modules/bacula/templates/bacula-dir.conf.erb @@ -105,8 +105,13 @@ Messages { Name = <%= @messages_name %> mailcommand = "/usr/lib/bacula/bsmtp -h localhost -f \"\(Bacula\) %r\" -s \"Bacula: %t %e of %c %l\" %r" operatorcommand = "/usr/lib/bacula/bsmtp -h localhost -f \"\(Bacula\) %r\" -s \"Bacula: Intervention needed for %j\" %r" - mail = <%= @operator_email %> = all - operator = <%= @operator_email %> = mount +<% if @email_all %> + mail = <%= @email_all %> = all +<% end %> +<% if @email_error != @email_all %> + mail on error = <%= @email_error %> = all +<% end %> + operator = <%= @email_operator %> = mount console = all, !skipped, !saved syslog = all append = "/var/lib/bacula/log" = all @@ -117,7 +122,7 @@ Messages { Messages { Name = Daemon mailcommand = "/usr/lib/bacula/bsmtp -h localhost -f \"\(Bacula\) %r\" -s \"Bacula daemon message\" %r" - mail = <%= @operator_email %> = all + mail = <%= @email_daemon %> = all console = all, !skipped, !saved syslog = all append = "/var/lib/bacula/log" = all