Defined Type: snmp::mibs::source

Defined in:
modules/snmp/manifests/mibs/source.pp

Overview

Parameters:

  • source (Any)
  • list (Any)
  • options (Any) (defaults to: {})


22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'modules/snmp/manifests/mibs/source.pp', line 22

define snmp::mibs::source(
  $source,
  $list,
  $options={},
) {

    $listname = "${title}list"

    # while Net-SNMP would be equally happy if we set this to $title, libsmi
    # isn't as smart and traverses directories non-recursively. We could either
    # modify /etc/smi.conf's path, or hardcode all of our sources to "site" but
    # making cleanup a little more difficult. This define doesn't support
    # ensure absent anyway, so do that for now.
    $destdir = 'site'

    file { "/etc/snmp-mibs-downloader/${title}.conf":
        ensure  => present,
        mode    => '0444',
        owner   => 'root',
        group   => 'root',
        content => template('snmp/mib.conf.erb'),
        require => Package['snmp-mibs-downloader'],
        notify  => Exec["download-mibs ${title}"],
    }

    file { "/etc/snmp-mibs-downloader/${listname}":
        ensure  => present,
        mode    => '0444',
        owner   => 'root',
        group   => 'root',
        source  => $list,
        require => Package['snmp-mibs-downloader'],
        notify  => Exec["download-mibs ${title}"],
    }

    exec { "download-mibs ${title}":
        path        => '/usr/sbin:/usr/bin:/sbin:/bin',
        require     => Package['snmp-mibs-downloader'],
        refreshonly => true,
    }

}