your home for end-user virtualization!

Using Puppet to configure LLDPAD on the Open Compute Winterfell

On our OCP Winterfell nodes, in CentOS 6; the 10GB Mellanox NIC’s show up as eth0 and eht1, where the 1GB management interface shows up as eth2. We are also using Brocade 10GB top-of-rack switches. So configuring LLDP was necessary for the servers to advertise themselves to the upstream switches. To do this, we use the LLDPAD package available  in the @base CentOS repo.

The next step is to create a Puppet module/mainfest to:

  1. Install the LLDPAD RPM from YUM.
  2. Start the LLDPAD service
  3. Ensure that the LLDPAD service is set to autostart at boot
  4. Configure eth0 and eth1 to broadcast their LLDP status to the upstream switches
  5. Ensure that it only runs once, not every time puppet agent runs

# This class installs lldpad
#
# Actions:
#   - Install the lldpad package
#
# Sample Usage:
#  class { 'lldpad': }
#
class lldpad {
  package { 'lldpad':
    ensure => installed,
  }


service { 'lldpad':
        ensure => running,
        enable => true,
        }

$once_lock="/var/lock/puppet-once"

exec { 'run-once-commands':
        command => "/bin/touch $once_lock",
        creates => $once_lock,
        notify => [Exec['lldptool adminstatus eth0']],
}

exec    { 'lldptool adminstatus eth0':
        command => "/usr/sbin/lldptool -L -i eth0 adminstatus=rxtx",
        require => Package['lldpad'],
        notify => [Exec['lldptool adminstatus ncb eth0']],
        refreshonly => true,
        }

exec    { 'lldptool adminstatus ncb eth0':
        command => "/usr/sbin/lldptool -i eth0 -g ncb -L adminstatus=rxtx",
        require => Package['lldpad'],
        notify => [Exec['lldptool adminstatus eth1']],
        refreshonly => true,
        }

exec    { 'lldptool adminstatus eth1':
        command => "/usr/sbin/lldptool -L -i eth1 adminstatus=rxtx",
        require => Package['lldpad'],
        notify => [Exec['lldptool adminstatus ncb eth1']],
        refreshonly => true,
        }

exec    { 'lldptool adminstatus ncb eth1':
        command => "/usr/sbin/lldptool -i eth1 -g ncb -L adminstatus=rxtx",
        require => Package['lldpad'],
        refreshonly => true,
        }
}

You can also grab the entire thing from my git repository on Github.

Tags: , , , ,

Search

Categories