-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinit.pp
40 lines (31 loc) · 1020 Bytes
/
init.pp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Main class to set up LLDP and check if network devices are ready to get LLDP.
#
# Usage: (Simple example to invoke only for physical machines)
#
# if $::virtual == 'physical' {
# include lldp
# }
class lldp {
package { 'lldpad':
ensure => present
}
service { 'lldpad':
enable => true,
ensure => running,
require => Package['lldpad'],
}
file { '/usr/local/bin/lldp_enable.sh':
owner => 'root',
group => 'root',
mode => '0744',
source => 'puppet:///modules/lldp/lldp_enable.sh',
require => Package['lldpad'],
}
exec { 'Check_lldp':
command => '/usr/local/bin/lldp_enable.sh',
require => File['/usr/local/bin/lldp_enable.sh'],
path => ['/usr/bin', '/usr/local/bin', '/bin', '/usr/sbin/'],
onlyif => "test `lldptool get-lldp -i eth0 adminStatus | cut -d'=' -f2` != 'rxtx' || test `lldptool get-lldp -i eth1 adminStatus | cut -d'=' -f2` != 'rxtx'",
user => 'root',
}
}