added template concat

This commit is contained in:
Arne Teuke
2017-07-25 16:39:28 +01:00
parent f5657930f6
commit 53e7b9d0b2
3 changed files with 20 additions and 1 deletions

View File

@@ -19,6 +19,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# @summary Class manages /etc/nagios/conf.d/templates.cfg through concat.
# @example cd_nagios::objects::templates { $name:
# ng_template_object => 'service',
# }
################################################################################
class cd_nagios::nagios::objects::template_rules (
@@ -41,5 +44,10 @@ class cd_nagios::nagios::objects::template_rules (
content => template[$ng_templates_head_erb]
notify => Service[$ng_service],
}
# example rule
cd_nagios::objects::templates { $name:
ng_template_object => 'service',
}
}
}

View File

@@ -22,10 +22,20 @@
################################################################################
define cd_nagios::nagios::objects::templates (
$ng_template_object = undef,
) {
$ng_target_templates = $::cd_nagios::params::ng_target_templates
$ng_nagios_server = $::cd_nagios::params::ng_nagios_server
$ng_target_templates = $::cd_nagios::params::ng_target_templates
$ng_templates_rule_erb = $::cd_nagios::params::ng_templates_rule_erb
if $::fqdn == $ng_nagios_server {
concat::fragment { $name:
target => $ng_target_templates,
content => template($ng_templates_rule_erb),
}
}
}

View File

@@ -961,6 +961,7 @@ $ng_certbot_live = "${ng_certbot_main_dir}/live"
# nagios
$ng_target_templates = "${ng_conf_d_dir}/templates.cfg"
$ng_templates_head_erb = 'cd_nagios/nagios/templates_cfg_head.erb'
$ng_templates_rule_erb = 'cd_nagios/nagios/templates_cfg_rule.erb'
$ng_target_timeperiods = "${ng_conf_d_dir}/timeperiods.cfg"
$ng_target_localhost = "${ng_conf_d_dir}/nagios_localhost.cfg"
$ng_target_host = "${ng_conf_d_dir}/nagios_host.cfg"