2023-01-17 13:30:45 -08:00
|
|
|
{ lib, entities, ... }:
|
|
|
|
|
|
|
|
let
|
2023-01-17 13:42:50 -08:00
|
|
|
getHostSite = hostname:
|
|
|
|
let site-name = entities.hosts."${hostname}".site;
|
|
|
|
in entities.sites."${site-name}";
|
|
|
|
getHostDomain = hostname:
|
|
|
|
let domain-name = entities.hosts."${hostname}".domain;
|
|
|
|
in entities.domains."${domain-name}";
|
2023-01-17 13:30:45 -08:00
|
|
|
getHostRealm = hostname: (getHostDomain hostname).gssapi-realm;
|
2023-01-18 12:54:21 -08:00
|
|
|
getHostFqdn = hostname:
|
|
|
|
let hostDomain = entities.hosts."${hostname}".domain;
|
|
|
|
in "${hostname}.${hostDomain}";
|
2023-01-17 13:30:45 -08:00
|
|
|
|
2023-01-26 13:36:10 -08:00
|
|
|
getHostNetworkSettings = hostname:
|
|
|
|
let
|
|
|
|
hostDomain = entities.hosts."${hostname}".domain;
|
|
|
|
hostNetwork = entities.zones."${hostDomain}";
|
|
|
|
in hostNetwork.hosts."${hostname}";
|
|
|
|
|
|
|
|
getHostIpv4 = hostname: (getHostNetworkSettings hostname).ipv4-address;
|
|
|
|
getHostIpv6 = hostname: (getHostNetworkSettings hostname).ipv6-address;
|
|
|
|
getHostIps =
|
|
|
|
filter (o: o != null) [ (getHostIpv4 hostname) (getHostIpv6 hostname) ];
|
|
|
|
|
|
|
|
in {
|
|
|
|
inherit getHostSite getHostDomain getHostRealm getHostFqdn getHostIpv4
|
|
|
|
getHostIpv6 getHostIps;
|
|
|
|
}
|