f37a7449cb
All checks were successful
Build all the nodes / bridge01 (push) Successful in 1m2s
Build all the nodes / geo01 (push) Successful in 1m6s
Build all the nodes / geo02 (push) Successful in 1m13s
Build all the nodes / rescue01 (push) Successful in 1m15s
Build all the nodes / storage01 (push) Successful in 1m16s
Build all the nodes / compute01 (push) Successful in 1m31s
Run pre-commit on all files / check (push) Successful in 25s
Build all the nodes / web02 (push) Successful in 1m14s
Build all the nodes / web03 (push) Successful in 1m11s
Build all the nodes / vault01 (push) Successful in 1m27s
Build all the nodes / web01 (push) Successful in 1m48s
51 lines
1.1 KiB
Nix
51 lines
1.1 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
nodeMeta,
|
|
...
|
|
}:
|
|
let
|
|
inherit (config.networking) hostName domain;
|
|
in
|
|
|
|
{
|
|
imports = [ ./module.nix ];
|
|
|
|
options.dgn-netbox-agent = {
|
|
enable = lib.mkEnableOption "DGNum netbox agent setup." // {
|
|
default = false;
|
|
};
|
|
};
|
|
|
|
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 = nodeMeta.vm-cluster != null;
|
|
cluster_name = nodeMeta.vm-cluster;
|
|
};
|
|
purge_old_devices = true;
|
|
hostname_cmd = "echo ${hostName}.${domain}";
|
|
datacenter_location = {
|
|
driver = "cmd:echo ${nodeMeta.site}";
|
|
regex = "(.*)";
|
|
};
|
|
device = {
|
|
tags = "netbox-agent";
|
|
# Default role
|
|
server_role = "Staging infra";
|
|
};
|
|
};
|
|
randomizedDelaySec = "3h";
|
|
environmentFile = config.age.secrets."netbox-agent".path;
|
|
};
|
|
|
|
age-secrets.sources = [ ./secrets ];
|
|
};
|
|
}
|