Adds RHEL support to snmpd module.
Parameterize the package name so that things work on multiple distros. Also, updates the snmpd module so that that the init script is written out on Ubuntu only (this is not required on RHEL). Change-Id: Id5868b85fc0a7a6057d9be16c76dad2efb834f0e Reviewed-on: https://review.openstack.org/23186 Reviewed-by: Jeremy Stanley <fungi@yuggoth.org> Reviewed-by: Khai Do <zaro0508@gmail.com> Reviewed-by: James E. Blair <corvus@inaugust.com> Reviewed-by: Clark Boylan <clark.boylan@gmail.com> Approved: James E. Blair <corvus@inaugust.com> Tested-by: Jenkins
This commit is contained in:
parent
36aefd0c48
commit
2f609a7223
@ -1,8 +1,12 @@
|
||||
# == Class: snmpd
|
||||
#
|
||||
class snmpd {
|
||||
|
||||
include snmpd::params
|
||||
|
||||
package { 'snmpd':
|
||||
ensure => present,
|
||||
name => $::snmpd::params::package_name,
|
||||
}
|
||||
service { 'snmpd':
|
||||
ensure => running,
|
||||
@ -12,6 +16,8 @@ class snmpd {
|
||||
File['/etc/init.d/snmpd'],
|
||||
],
|
||||
}
|
||||
|
||||
if ($::operatingsystem == 'Ubuntu') {
|
||||
# This file is only needed on machines pre-precise. There is a bug in
|
||||
# the previous init script versions which causes them to attempt
|
||||
# snmptrapd even if it's configured not to run, and then to report
|
||||
@ -25,6 +31,11 @@ class snmpd {
|
||||
replace => true,
|
||||
require => Package['snmpd'],
|
||||
}
|
||||
|
||||
File['/etc/init.d/snmpd'] -> Service['snmpd']
|
||||
|
||||
}
|
||||
|
||||
file { '/etc/snmp/snmpd.conf':
|
||||
ensure => present,
|
||||
owner => 'root',
|
||||
|
17
modules/snmpd/manifests/params.pp
Normal file
17
modules/snmpd/manifests/params.pp
Normal file
@ -0,0 +1,17 @@
|
||||
# Class: snmpd::params
|
||||
#
|
||||
# This class holds parameters that need to be
|
||||
# accessed by other classes.
|
||||
class snmpd::params {
|
||||
case $::osfamily {
|
||||
'Redhat': {
|
||||
$package_name = 'net-snmp'
|
||||
}
|
||||
'Debian', 'Ubuntu': {
|
||||
$package_name = 'snmpd'
|
||||
}
|
||||
default: {
|
||||
fail("Unsupported osfamily: ${::osfamily} The 'snmpd' module only supports osfamily Ubuntu or Redhat(slaves only).")
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user