diff --git a/modules/snmpd/manifests/init.pp b/modules/snmpd/manifests/init.pp index 99a5e965dd..e4fa2b3759 100644 --- a/modules/snmpd/manifests/init.pp +++ b/modules/snmpd/manifests/init.pp @@ -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,19 +16,26 @@ class 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 - # snmptrapd even if it's configured not to run, and then to report - # failure. - file { '/etc/init.d/snmpd': - ensure => present, - owner => 'root', - group => 'root', - mode => '0755', - source => 'puppet:///modules/snmpd/snmpd.init', - replace => true, - require => Package['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 + # failure. + file { '/etc/init.d/snmpd': + ensure => present, + owner => 'root', + group => 'root', + mode => '0755', + source => 'puppet:///modules/snmpd/snmpd.init', + replace => true, + require => Package['snmpd'], + } + + File['/etc/init.d/snmpd'] -> Service['snmpd'] + } + file { '/etc/snmp/snmpd.conf': ensure => present, owner => 'root', diff --git a/modules/snmpd/manifests/params.pp b/modules/snmpd/manifests/params.pp new file mode 100644 index 0000000000..0808467bf1 --- /dev/null +++ b/modules/snmpd/manifests/params.pp @@ -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).") + } + } +}