Puppet Class: profile::netbox::host
- Defined in:
- modules/profile/manifests/netbox/host.pp
Summary
profile for collecting netbox host dataOverview
SPDX-License-Identifier: Apache-2.0
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 |
# File 'modules/profile/manifests/netbox/host.pp', line 5
class profile::netbox::host (
Netbox::Device::Status $status = lookup('profile::netbox::host::status'),
Optional[Netbox::Device::Location] $location = lookup('profile::netbox::host::location'),
) {
unless $status == 'active' {
warning("${facts['networking']['fqdn']} is ${status} in Netbox")
}
$_status = $status ? {
'active' => wmflib::ansi::fg($status, 'green'),
default => wmflib::ansi::fg($status, 'red'),
}
motd::message { 'netbox status':
message => "Netbox Status: ${_status}",
priority => 1,
}
unless $location {
warning("${facts['networking']['fqdn']}: no Netbox location found")
} else {
$message = $location ? {
Netbox::Device::Location::Virtual => "Virtual Machine on Ganeti cluster ${location['ganeti_cluster']} and group ${location['ganeti_group']}",
default => "Bare Metal host on site ${location['site']} and rack ${location['rack']}",
}
motd::message { 'netbox location':
message => $message,
}
}
}
|