From 3c86d6a60034f0e82e6ce3e7968db0c711d3d9e0 Mon Sep 17 00:00:00 2001 From: varac Date: Sat, 26 Jan 2013 22:36:52 +0100 Subject: Added $stored_config parameter to disabledisable collection of exported resources On masterless setups, this module would otherwise complain --- manifests/apache.pp | 4 ++- manifests/base.pp | 62 +++------------------------------------------- manifests/init.pp | 1 + manifests/stored_config.pp | 61 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 69 insertions(+), 59 deletions(-) create mode 100644 manifests/stored_config.pp diff --git a/manifests/apache.pp b/manifests/apache.pp index 8da9c11..54bd24c 100644 --- a/manifests/apache.pp +++ b/manifests/apache.pp @@ -2,12 +2,14 @@ class nagios::apache( $allow_external_cmd = false, $manage_shorewall = false, - $manage_munin = false + $manage_munin = false, + $stored_config = true ) { class{'::nagios': httpd => 'apache', allow_external_cmd => $allow_external_cmd, manage_munin => $manage_munin, manage_shorewall => $manage_shorewall, + stored_config => $stored_config } } diff --git a/manifests/base.pp b/manifests/base.pp index 4922cdb..6fca2d3 100644 --- a/manifests/base.pp +++ b/manifests/base.pp @@ -75,64 +75,6 @@ class nagios::base { } } - Nagios_command <<||>> - Nagios_contactgroup <<||>> - Nagios_contact <<||>> - Nagios_hostdependency <<||>> - Nagios_hostescalation <<||>> - Nagios_hostextinfo <<||>> - Nagios_hostgroup <<||>> - Nagios_host <<||>> - Nagios_servicedependency <<||>> - Nagios_serviceescalation <<||>> - Nagios_servicegroup <<||>> - Nagios_serviceextinfo <<||>> - Nagios_service <<||>> - Nagios_timeperiod <<||>> - - Nagios_command <||> { - notify => Service['nagios'], - } - Nagios_contact <||> { - notify => Service['nagios'], - } - Nagios_contactgroup <||> { - notify => Service['nagios'], - } - Nagios_host <||> { - notify => Service['nagios'], - } - Nagios_hostdependency <||> { - notify => Service['nagios'], - } - Nagios_hostescalation <||> { - notify => Service['nagios'], - } - Nagios_hostextinfo <||> { - notify => Service['nagios'], - } - Nagios_hostgroup <||> { - notify => Service['nagios'], - } - Nagios_service <||> { - notify => Service['nagios'], - } - Nagios_servicegroup <||> { - notify => Service['nagios'], - } - Nagios_servicedependency <||> { - notify => Service['nagios'], - } - Nagios_serviceescalation <||> { - notify => Service['nagios'], - } - Nagios_serviceextinfo <||> { - notify => Service['nagios'], - } - Nagios_timeperiod <||> { - notify => Service['nagios'], - } - file{ [ "${cfg_dir}/nagios_command.cfg", "${cfg_dir}/nagios_contact.cfg", @@ -179,4 +121,8 @@ class nagios::base { purge => true; } } + + if ( $nagios::stored_config == true ) { + include ::nagios::stored_config + } } diff --git a/manifests/init.pp b/manifests/init.pp index c4d7725..8669b19 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -23,6 +23,7 @@ class nagios( $service_atboot = true, $purge_resources = true, $gpgkey_checks = {}, + $stored_config = true ) { case $nagios::httpd { 'absent': { } diff --git a/manifests/stored_config.pp b/manifests/stored_config.pp new file mode 100644 index 0000000..b04d640 --- /dev/null +++ b/manifests/stored_config.pp @@ -0,0 +1,61 @@ +# collect exported resources when using 'stored_config => true' +class nagios::stored_config { + + Nagios_command <<||>> + Nagios_contactgroup <<||>> + Nagios_contact <<||>> + Nagios_hostdependency <<||>> + Nagios_hostescalation <<||>> + Nagios_hostextinfo <<||>> + Nagios_hostgroup <<||>> + Nagios_host <<||>> + Nagios_servicedependency <<||>> + Nagios_serviceescalation <<||>> + Nagios_servicegroup <<||>> + Nagios_serviceextinfo <<||>> + Nagios_service <<||>> + Nagios_timeperiod <<||>> + + Nagios_command <||> { + notify => Service['nagios'], + } + Nagios_contact <||> { + notify => Service['nagios'], + } + Nagios_contactgroup <||> { + notify => Service['nagios'], + } + Nagios_host <||> { + notify => Service['nagios'], + } + Nagios_hostdependency <||> { + notify => Service['nagios'], + } + Nagios_hostescalation <||> { + notify => Service['nagios'], + } + Nagios_hostextinfo <||> { + notify => Service['nagios'], + } + Nagios_hostgroup <||> { + notify => Service['nagios'], + } + Nagios_service <||> { + notify => Service['nagios'], + } + Nagios_servicegroup <||> { + notify => Service['nagios'], + } + Nagios_servicedependency <||> { + notify => Service['nagios'], + } + Nagios_serviceescalation <||> { + notify => Service['nagios'], + } + Nagios_serviceextinfo <||> { + notify => Service['nagios'], + } + Nagios_timeperiod <||> { + notify => Service['nagios'], + } +} -- cgit v1.2.3