diff --git a/logwatch/manifests/init.pp b/logwatch/manifests/init.pp index 05e4341..f1b33be 100644 --- a/logwatch/manifests/init.pp +++ b/logwatch/manifests/init.pp @@ -2,9 +2,13 @@ # # === Global variables # -# $logwatch_mailto +# $logwatch_mailto: # Logwatch mail recipient. # +# $logwatch_level: +# Logwatch detail level for report. Valid values are +# from 0 to 10. +# class logwatch { case $::kernel { @@ -18,15 +22,13 @@ class logwatch { } } - if $logwatch_mailto { - file { "/etc/logwatch/conf/logwatch.conf": - ensure => present, - mode => "0644", - owner => "root", - group => "root", - content => "MailTo = ${logwatch_mailto}\n", - require => Package["logwatch"], - } + file { "/etc/logwatch/conf/logwatch.conf": + ensure => present, + content => template("logwatch/logwatch.conf.erb"), + mode => "0644", + owner => "root", + group => "root", + require => Package["logwatch"], } } diff --git a/logwatch/templates/logwatch.conf.erb b/logwatch/templates/logwatch.conf.erb new file mode 100644 index 0000000..ab25923 --- /dev/null +++ b/logwatch/templates/logwatch.conf.erb @@ -0,0 +1,7 @@ +# autogenerated by puppet +<% if @logwatch_mailto -%> +MailTo = <%= @logwatch_mailto %> +<% end -%> +<% if @logwatch_level -%> +Detail = <%= @logwatch_level %> +<% end -%>