Puppet Class: profile::netbox::host

Defined in:
modules/profile/manifests/netbox/host.pp

Overview

Parameters:

  • status (Netbox::Host::Status) (defaults to: lookup('profile::netbox::host::status'))

    the netbox status of the host or unknown

  • location (Optional[Netbox::Host::Location]) (defaults to: lookup('profile::netbox::host::location'))

    location data including site and cluster



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'modules/profile/manifests/netbox/host.pp', line 4

class profile::netbox::host (
    Netbox::Host::Status             $status   = lookup('profile::netbox::host::status'),
    Optional[Netbox::Host::Location] $location = lookup('profile::netbox::host::location'),
) {
    unless $status == 'active' {
        warning("${facts['networking']['fqdn']} is ${status} in netbox")
    }
    unless $location {
        warning("${facts['networking']['fqdn']}: no netbox location found")
    } else {
        $message = $location ? {
            Netbox::Host::Location::Virtual => "Virtual Machine on Ganeti cluster: ${location['ganeti_cluster']}",
            default                         => "Bare Metal Rack: ${location['rack']}",
        }
        motd::message { 'netbox location':
            message => $message,
        }
    }
}