From 5d12bf44374b9349ee39a4c7cafffca17f286b1f Mon Sep 17 00:00:00 2001 From: Arne Teuke Date: Fri, 21 Jul 2017 13:51:07 +0100 Subject: [PATCH] found format options both for hosts and ips --- manifests/params.pp | 13 ++++++------- templates/httpd/nagios_conf.erb | 20 ++++++++------------ 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/manifests/params.pp b/manifests/params.pp index cc047d6..2a1adee 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -194,12 +194,11 @@ # "Send Notification" to be unchecked. # @param [boolean] ng_use_selinux_tools Whether to enable selinux tools and # policies. only effective if selinux is enabled. -# @param [array] ng_required_hosts Array of **__FQDNs__** for hosts which -# should be allowed/required. every entry in the array creates a new line in -# the configuration file. -# @param [array] ng_required_ips Array of **__Ip addresses __** for hosts which -# should be allowed/reqired. every entry in the array creates a new line in -# the configuration file +# @param [string] ng_required_hosts String of **__FQDNs__** for hosts which +# should be allowed/required. Requires format +# 'host1.example.com host2.example.com' +# @param [string] ng_required_ips string of **__Ip addresses __** for hosts which +# should be allowed/reqired. Requires format 'ipaddress ip address range' ############################################################################### class cd_nagios::params ( @@ -309,7 +308,7 @@ $ng_use_selinux_tools = true, # httpd $ng_required_hosts = '', -$ng_required_ips = ['127.0.0.0/8'], +$ng_required_ips = '127.0.0.0/8', ) { diff --git a/templates/httpd/nagios_conf.erb b/templates/httpd/nagios_conf.erb index 6d5f0e8..2e84105 100644 --- a/templates/httpd/nagios_conf.erb +++ b/templates/httpd/nagios_conf.erb @@ -20,13 +20,11 @@ ScriptAlias /nagios/cgi-bin/ "/usr/lib64/nagios/cgi-bin/" Require all granted <% unless @ng_required_hosts.empty? -%> -<% @ng_required_hosts.each do |required_host| -%> - Require host <%= required_host %> -<% end end -%> -<% if @ng_required_ips != [] -%> -<% @ng_required_ips.each do |required_ips| -%> + Require host <%= @ng_required_hosts %> +<% end -%> +<% unless @ng_required_ips.empty? -%> Require ip <%= required_ips %> -<% end end -%> +<% end -%> AuthName "Nagios Access" AuthType Basic AuthUserFile /etc/nagios/passwd @@ -57,13 +55,11 @@ Alias /nagios "/usr/share/nagios/html" Require all granted <% unless @ng_required_hosts.empty? -%> -<% @ng_required_hosts.each do |required_host| -%> - Require host <%= required_host %> -<% end end -%> -<% if @ng_required_ips != [] -%> -<% @ng_required_ips.each do |required_ips| -%> + Require host <%= @ng_required_hosts %> +<% end -%> +<% unless @ng_required_ips.empty? -%> Require ip <%= required_ips %> -<% end end -%> +<% end -%> AuthName "Nagios Access" AuthType Basic AuthUserFile /etc/nagios/passwd