From e7b950e75d1d9e435343eccb64d54dff3239c7af Mon Sep 17 00:00:00 2001 From: hdep Date: Thu, 9 Aug 2018 17:16:54 +0200 Subject: [PATCH 1/9] Add snmpv2_enable variable --- manifests/init.pp | 1 + 1 file changed, 1 insertion(+) diff --git a/manifests/init.pp b/manifests/init.pp index e92cae4e..3f77538e 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -353,6 +353,7 @@ $agentx_socket = $snmp::params::agentx_socket, $agentx_timeout = $snmp::params::agentx_timeout, $agentx_retries = $snmp::params::agentx_retries, + $snmpv2_enable = $snmp::params::snmpv2_enable ) inherits snmp::params { # Validate our booleans validate_bool($master) From 16ef80f7ce1d89121447dbfb5d3325a4bff2f0b1 Mon Sep 17 00:00:00 2001 From: hdep Date: Thu, 9 Aug 2018 17:17:18 +0200 Subject: [PATCH 2/9] Fix missing comma --- manifests/init.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/init.pp b/manifests/init.pp index 3f77538e..41470512 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -353,7 +353,7 @@ $agentx_socket = $snmp::params::agentx_socket, $agentx_timeout = $snmp::params::agentx_timeout, $agentx_retries = $snmp::params::agentx_retries, - $snmpv2_enable = $snmp::params::snmpv2_enable + $snmpv2_enable = $snmp::params::snmpv2_enable, ) inherits snmp::params { # Validate our booleans validate_bool($master) From 74ae8730df28c8c1f41b61203d458f936a11f57a Mon Sep 17 00:00:00 2001 From: hdep Date: Thu, 9 Aug 2018 17:22:40 +0200 Subject: [PATCH 3/9] Add comments and validate bool --- manifests/init.pp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/manifests/init.pp b/manifests/init.pp index 41470512..a210696a 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -257,6 +257,11 @@ # Defines the number of retries for an AgentX request. # Default: 5 # +# [*snmpv2_enable*] +# Disable com2sec, group, and access in snmpd.conf +# +# Default: false +# # === Actions: # # Installs the Net-SNMP daemon package, service, and configuration. @@ -363,6 +368,7 @@ validate_bool($service_hasstatus) validate_bool($service_hasrestart) validate_bool($openmanage_enable) + validate_bool($snmpv2_enable) # Validate our arrays validate_array($snmptrapdaddr) From 34d4b1002c43e56b3923b8122e1a497eb187ac0a Mon Sep 17 00:00:00 2001 From: hdep Date: Thu, 9 Aug 2018 17:26:02 +0200 Subject: [PATCH 4/9] change default value for snmpv2_enable --- manifests/init.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/init.pp b/manifests/init.pp index a210696a..2394a11a 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -260,7 +260,7 @@ # [*snmpv2_enable*] # Disable com2sec, group, and access in snmpd.conf # -# Default: false +# Default: true # # === Actions: # From 38a68a204150bab6cf65a39a28bd2b2231928217 Mon Sep 17 00:00:00 2001 From: hdep Date: Thu, 9 Aug 2018 17:27:14 +0200 Subject: [PATCH 5/9] Add if statement for snmpv2_enable --- templates/snmpd.conf.erb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/templates/snmpd.conf.erb b/templates/snmpd.conf.erb index 9e90aa1d..4b374eca 100644 --- a/templates/snmpd.conf.erb +++ b/templates/snmpd.conf.erb @@ -60,6 +60,7 @@ rocommunity6 <%= c %> <%= n %> # ------------------------------------------------------------------------------ # VACM Configuration # sec.name source community +<% if @snmpv2_enable -%> <% @com2sec.each do |c| -%> com2sec <%= c %> <% end -%> @@ -82,6 +83,7 @@ view <%= view %> <% @accesses.each do |access| -%> access <%= access %> <% end -%> +<% end -%> # ------------------------------------------------------------------------------ # Typed-View Configuration From 1e4553cff2083611217b3164d0b9187e9574004a Mon Sep 17 00:00:00 2001 From: hdep Date: Thu, 9 Aug 2018 17:29:55 +0200 Subject: [PATCH 6/9] Add snmpv2_enable --- manifests/params.pp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/manifests/params.pp b/manifests/params.pp index bb4920bf..e672287c 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -404,6 +404,13 @@ $safe_trap_service_hasrestart = $trap_service_hasrestart } + $snmp_snmpv2_enable = getvar('::snmpv2_enable') + if $snmp_openmanage_enable { + $snmpv2_enable = $snmp_snmpv2_enable + } else { + $snmpv2_enable = true + } + $template_snmpd_conf = 'snmp/snmpd.conf.erb' $template_snmpd_sysconfig = "snmp/snmpd.sysconfig-${::osfamily}.erb" $template_snmptrapd = 'snmp/snmptrapd.conf.erb' From 1941e67e5b31c72f7d3952419986d906c396ca24 Mon Sep 17 00:00:00 2001 From: hdep Date: Thu, 9 Aug 2018 17:46:36 +0200 Subject: [PATCH 7/9] Move views block outside snmpv2_enable scope --- templates/snmpd.conf.erb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/templates/snmpd.conf.erb b/templates/snmpd.conf.erb index 4b374eca..a5d29446 100644 --- a/templates/snmpd.conf.erb +++ b/templates/snmpd.conf.erb @@ -74,17 +74,15 @@ com2sec6 <%= c %> group <%= group %> <% end -%> -# name incl/excl subtree mask(optional) -<% @views.each do |view| -%> -view <%= view %> -<% end -%> - # group context sec.model sec.level prefix read write notif <% @accesses.each do |access| -%> access <%= access %> <% end -%> <% end -%> - +# name incl/excl subtree mask(optional) +<% @views.each do |view| -%> +view <%= view %> +<% end -%> # ------------------------------------------------------------------------------ # Typed-View Configuration From 52d200a0fdcd53db115109440b59f6546f0dcbeb Mon Sep 17 00:00:00 2001 From: Unknown Date: Fri, 10 Aug 2018 11:50:17 +0200 Subject: [PATCH 8/9] Fixing trailing whitespace --- manifests/params.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/params.pp b/manifests/params.pp index e672287c..8df3ddd1 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -410,7 +410,7 @@ } else { $snmpv2_enable = true } - + $template_snmpd_conf = 'snmp/snmpd.conf.erb' $template_snmpd_sysconfig = "snmp/snmpd.sysconfig-${::osfamily}.erb" $template_snmptrapd = 'snmp/snmptrapd.conf.erb' From 4ba2a2c9b063e20db38139111461002d394940aa Mon Sep 17 00:00:00 2001 From: Unknown Date: Fri, 10 Aug 2018 13:24:52 +0200 Subject: [PATCH 9/9] fixing trailing whitespace --- manifests/params.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/params.pp b/manifests/params.pp index 8df3ddd1..0223deda 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -410,7 +410,7 @@ } else { $snmpv2_enable = true } - + $template_snmpd_conf = 'snmp/snmpd.conf.erb' $template_snmpd_sysconfig = "snmp/snmpd.sysconfig-${::osfamily}.erb" $template_snmptrapd = 'snmp/snmptrapd.conf.erb'