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:
Dan Prince 2013-02-28 12:20:33 -05:00 committed by Jenkins
parent 36aefd0c48
commit 2f609a7223
2 changed files with 40 additions and 12 deletions

View File

@ -1,8 +1,12 @@
# == Class: snmpd # == Class: snmpd
# #
class snmpd { class snmpd {
include snmpd::params
package { 'snmpd': package { 'snmpd':
ensure => present, ensure => present,
name => $::snmpd::params::package_name,
} }
service { 'snmpd': service { 'snmpd':
ensure => running, ensure => running,
@ -12,19 +16,26 @@ class snmpd {
File['/etc/init.d/snmpd'], File['/etc/init.d/snmpd'],
], ],
} }
# This file is only needed on machines pre-precise. There is a bug in
# the previous init script versions which causes them to attempt if ($::operatingsystem == 'Ubuntu') {
# snmptrapd even if it's configured not to run, and then to report # This file is only needed on machines pre-precise. There is a bug in
# failure. # the previous init script versions which causes them to attempt
file { '/etc/init.d/snmpd': # snmptrapd even if it's configured not to run, and then to report
ensure => present, # failure.
owner => 'root', file { '/etc/init.d/snmpd':
group => 'root', ensure => present,
mode => '0755', owner => 'root',
source => 'puppet:///modules/snmpd/snmpd.init', group => 'root',
replace => true, mode => '0755',
require => Package['snmpd'], source => 'puppet:///modules/snmpd/snmpd.init',
replace => true,
require => Package['snmpd'],
}
File['/etc/init.d/snmpd'] -> Service['snmpd']
} }
file { '/etc/snmp/snmpd.conf': file { '/etc/snmp/snmpd.conf':
ensure => present, ensure => present,
owner => 'root', owner => 'root',

View 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).")
}
}
}