infrastructure/modules/dgn-netbox-agent/default.nix
sinavir 747d8c08cb
All checks were successful
build configuration / build_vault01 (pull_request) Successful in 1m55s
build configuration / build_web02 (pull_request) Successful in 1m38s
build configuration / build_compute01 (pull_request) Successful in 2m7s
build configuration / build_web01 (pull_request) Successful in 1m59s
build configuration / build_storage01 (pull_request) Successful in 2m12s
build configuration / build_rescue01 (pull_request) Successful in 1m2s
build configuration / build_compute01 (push) Successful in 1m5s
build configuration / build_storage01 (push) Successful in 1m8s
build configuration / build_vault01 (push) Successful in 1m6s
lint / check (push) Successful in 22s
build configuration / build_web01 (push) Successful in 1m27s
build configuration / build_web02 (push) Successful in 53s
build configuration / build_rescue01 (push) Successful in 51s
feat(netbox-agent): init
2024-03-28 13:26:19 +01:00

48 lines
1.2 KiB
Nix

{
config,
meta,
name,
lib,
...
}:
let
inherit (config.deployment) tags;
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 = [ ./. ];
};
}