Puppet Class: lldpd
- Defined in:
- manifests/init.pp
Summary
A module to manage lldpd and related factsOverview
lldpd
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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'manifests/init.pp', line 13
class lldpd (
Enum['present', 'absent', 'latest'] $ensure = 'present',
Boolean $manage_repo = false,
Boolean $manage_service = true,
Optional[String[1]] $repourl = undef,
String[1] $apt_key_hash = '4f9e668fbdaaedf4fc8d83f4eb98db33553d7f4e1f0bca212d0a7ccc9f1a6adf',
) {
if $manage_repo {
case $facts['os']['family'] {
'RedHat': {
yumrepo { 'lldpd':
ensure => 'present',
descr => 'lldpd toolset',
gpgkey => "https://download.opensuse.org/repositories/home:/vbernat/${repourl}/repodata/repomd.xml.key",
baseurl => "https://download.opensuse.org/repositories/home:/vbernat/${repourl}/",
gpgcheck => 1,
}
}
'Debian': {
# place the key in the keyrings directory where apt won't search for keys for all repos
# ascii encoded files need to end with *.asc, binary files with .gpg...
file { '/usr/share/keyrings/lldpd.asc':
ensure => 'file',
source => "https://download.opensuse.org/repositories/home:/vbernat/${repourl}/Release.key",
owner => 'root',
group => 'root',
mode => '0644',
checksum_value => $apt_key_hash,
checksum => 'sha256',
}
# purge old key files that we installed in previous releases
file { ['/etc/apt/trusted.gpg.d/home_vbernat.gpg', '/etc/apt/trusted.gpg.d/home_vbernat.gpg~']:
ensure => absent,
}
# previously managed by apt::key, we need to purge it from the global keyring in /etc/apt/trusted.gpg
include apt # required so apt::key can access variables from init.pp
apt::key { 'EF795E4D26E48F1D7661267B431C37A97C3E114B':
ensure => 'absent',
}
apt::source { 'lldpd':
location => "https://download.opensuse.org/repositories/home:/vbernat/${repourl}",
release => ' ',
repos => '/',
keyring => '/usr/share/keyrings/lldpd.asc',
require => File['/usr/share/keyrings/lldpd.asc'],
}
}
default: {
warning("`\$manage_repo` not valid for: ${facts['os']['family']}")
}
}
}
package { 'lldpd':
ensure => $ensure,
}
if $manage_service {
service { 'lldpd':
ensure => 'running',
enable => true,
require => Package['lldpd'],
}
}
}
|