From 167a752af764b294df5eaa92404b997de1af359e Mon Sep 17 00:00:00 2001 From: Eric Zounes Date: Thu, 14 Jan 2016 13:18:06 -0800 Subject: [PATCH] Add parameters to the monitoring module class for more flexibility. --- manifests/mod/monitoring.pp | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/manifests/mod/monitoring.pp b/manifests/mod/monitoring.pp index e3b97ea7..5b1c6ab2 100644 --- a/manifests/mod/monitoring.pp +++ b/manifests/mod/monitoring.pp @@ -1,6 +1,11 @@ # == Class icingaweb2::mod::monitoring # class icingaweb2::mod::monitoring ( + $protected_customvars = '*pw*,*pass*,community', + $backend_type = 'ido', + $backend_resource = 'icinga_ido', + $transport = 'local', + $transport_path = '/var/run/icinga2/cmd/icinga2.cmd', ) { require ::icingaweb2 @@ -26,6 +31,16 @@ mode => $::icingaweb2::config_dir_mode; } + $monitoring_mod_files = [ + "${::icingaweb2::config_dir}/modules/monitoring/backends.ini", + "${::icingaweb2::config_dir}/modules/monitoring/config.ini", + "${::icingaweb2::config_dir}/modules/monitoring/commandtransports.ini", + ] + + file { $monitoring_mod_files: + ensure => present, + } + Ini_Setting { ensure => present, require => File["${::icingaweb2::config_dir}/modules/monitoring"], @@ -34,35 +49,35 @@ ini_setting { 'security settings': section => 'security', setting => 'protected_customvars', - value => '"*pw*,*pass*,community"', + value => "\"${protected_customvars}\"", path => "${::icingaweb2::config_dir}/modules/monitoring/config.ini", } ini_setting { 'backend ido setting': section => 'icinga_ido', setting => 'type', - value => 'ido', + value => $backend_type, path => "${::icingaweb2::config_dir}/modules/monitoring/backends.ini", } ini_setting { 'backend resource setting': section => 'icinga_ido', setting => 'resource', - value => 'icinga_ido', + value => $backend_resource, path => "${::icingaweb2::config_dir}/modules/monitoring/backends.ini", } ini_setting { 'command transport setting': section => 'icinga2', setting => 'transport', - value => 'local', + value => $transport, path => "${::icingaweb2::config_dir}/modules/monitoring/commandtransports.ini", } ini_setting { 'command transport path setting': section => 'icinga2', setting => 'path', - value => '/var/run/icinga2/cmd/icinga2.cmd', + value => $transport_path, path => "${::icingaweb2::config_dir}/modules/monitoring/commandtransports.ini", }