Tom Hubrecht
b36b0d7d67
All checks were successful
Check meta / check_meta (push) Successful in 20s
Check meta / check_dns (push) Successful in 43s
build configuration / build_storage01 (push) Successful in 58s
build configuration / build_compute01 (push) Successful in 1m4s
build configuration / build_vault01 (push) Successful in 52s
build configuration / build_web02 (push) Successful in 51s
lint / check (push) Successful in 24s
build configuration / build_rescue01 (push) Successful in 47s
build configuration / build_web01 (push) Successful in 1m21s
47 lines
1.1 KiB
Nix
47 lines
1.1 KiB
Nix
{
|
|
config,
|
|
meta,
|
|
name,
|
|
lib,
|
|
...
|
|
}:
|
|
let
|
|
inherit (config.networking) hostName domain;
|
|
in
|
|
{
|
|
|
|
options.dgn-netbox-agent = {
|
|
enable = lib.mkEnableOption "DGNum netbox agent setup." // {
|
|
default = true;
|
|
};
|
|
};
|
|
config = lib.mkIf config.dgn-netbox-agent.enable {
|
|
services.netbox-agent = {
|
|
enable = true;
|
|
settings = {
|
|
netbox.url = "https://netbox.dgnum.eu/";
|
|
network.ignore_interfaces = "(lo|dummy.*|docker.*|podman.*)";
|
|
register = true;
|
|
update_all = true;
|
|
virtual = {
|
|
enabled = meta.nodes.${name}.vm-cluster != null;
|
|
cluster_name = meta.nodes.${name}.vm-cluster;
|
|
};
|
|
purge_old_devices = true;
|
|
hostname_cmd = "echo ${hostName}.${domain}";
|
|
datacenter_location = {
|
|
driver = "cmd:echo ${meta.nodes.${name}.site}";
|
|
regex = "(.*)";
|
|
};
|
|
device = {
|
|
tags = "netbox-agent";
|
|
# Default role
|
|
server_role = "Staging infra";
|
|
};
|
|
};
|
|
randomizedDelaySec = "1h";
|
|
environmentFile = config.age.secrets."netbox-agent".path;
|
|
};
|
|
age-secrets.sources = [ ./. ];
|
|
};
|
|
}
|