added and linked template_rules

This commit is contained in:
Arne Teuke
2017-07-25 16:30:03 +01:00
parent 0f8cf13c3e
commit 633f59375b
7 changed files with 282 additions and 3 deletions

View File

@@ -19,8 +19,8 @@
# 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 all commands known to NAGIOS through Puppet exports,
# and populates /etc/nagios/conf.d/nagios_commands.cfg
##############################################################################
# and populates /etc/nagios/conf.d/nagios_commands.cfg.
################################################################################
class cd_nagios::nagios::objects::commands (
) inherits cd_nagios::params {

View File

@@ -0,0 +1,45 @@
## cd_nagios::nagios::objects::template_rules.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# # License:
# This file is part of cd_nagios.
#
# cd_nagios is used for providing automatic configuration of Nagios
# Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# 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.
################################################################################
class cd_nagios::nagios::objects::template_rules (
) inherits cd_nagios::params {
if $::fqdn == $ng_nagios_server {
# create the templates.cfg file
concat { $ng_target_templates:
ensure => present,
path => $ng_target_templates,
owner => $ng_user,
group => $ng_user,
mode => '0640',
selrange => s0,
selrole => object_r,
aeltype => nagios_etc_t,
seluser => system_u,
content => template[$ng_templates_head_erb]
notify => Service[$ng_service],
}
}
}

View File

@@ -0,0 +1,29 @@
## cd_nagios::nagios::objects::templates.pp
# Module name: cd_nagios
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
# # License:
# This file is part of cd_nagios.
#
# cd_nagios is used for providing automatic configuration of Nagios
# Copyright (C) 2016 ConfDroid (copyright@ConfDroid.com)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# 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 Define manages populates /etc/nagios/conf.d/templates.cfg.
################################################################################
defie cd_nagios::nagios::objects::templates (
) {
$ng_target_templates = $::cd_nagios::params::ng_target_templates
}

View File

@@ -959,8 +959,8 @@ $ng_certbot_check = "${ng_certbot_archive}/${ng_webserver_name}/cert1.pe
$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_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"

View File

@@ -29,6 +29,7 @@ class cd_nagios::server::service (
require cd_nagios::server::files
require cd_nagios::server::access_rules
require cd_nagios::nagios::objects::commands
require cd_nagios::nagios::objects::template_rules
service { $ng_service:
ensure => running,