diff --git a/manifests/init.pp b/manifests/init.pp index e92cae4e..2394a11a 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: true +# # === Actions: # # Installs the Net-SNMP daemon package, service, and configuration. @@ -353,6 +358,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) @@ -362,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) diff --git a/manifests/params.pp b/manifests/params.pp index bb4920bf..0223deda 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' diff --git a/templates/snmpd.conf.erb b/templates/snmpd.conf.erb index 9e90aa1d..a5d29446 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 -%> @@ -73,16 +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