infrastructure/modules/dgn-netbox-agent/default.nix
Tom Hubrecht 972b9554b7
All checks were successful
Check meta / check_meta (push) Successful in 18s
Check meta / check_dns (push) Successful in 19s
Check meta / check_dns (pull_request) Successful in 21s
Check meta / check_meta (pull_request) Successful in 21s
build configuration / build_and_cache_geo01 (pull_request) Successful in 1m8s
build configuration / build_and_cache_geo02 (pull_request) Successful in 1m14s
build configuration / build_and_cache_storage01 (pull_request) Successful in 1m21s
build configuration / build_and_cache_compute01 (pull_request) Successful in 1m44s
build configuration / build_and_cache_vault01 (pull_request) Successful in 1m24s
build configuration / build_and_cache_rescue01 (pull_request) Successful in 1m35s
lint / check (pull_request) Successful in 25s
build configuration / build_and_cache_web02 (pull_request) Successful in 1m10s
build configuration / build_and_cache_bridge01 (pull_request) Successful in 1m2s
build configuration / build_and_cache_web03 (pull_request) Successful in 1m13s
build configuration / build_and_cache_web01 (pull_request) Successful in 1m44s
build configuration / build_and_cache_geo01 (push) Successful in 1m9s
build configuration / build_and_cache_geo02 (push) Successful in 1m15s
build configuration / build_and_cache_rescue01 (push) Successful in 1m20s
build configuration / build_and_cache_storage01 (push) Successful in 1m24s
build configuration / build_and_cache_vault01 (push) Successful in 1m28s
build configuration / build_and_cache_compute01 (push) Successful in 1m44s
lint / check (push) Successful in 24s
build configuration / build_and_cache_bridge01 (push) Successful in 1m1s
build configuration / build_and_cache_web02 (push) Successful in 1m11s
build configuration / build_and_cache_web03 (push) Successful in 1m10s
build configuration / build_and_cache_web01 (push) Successful in 1m44s
feat(netbox-agent): Internalize
2024-10-21 19:38:11 +02:00

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 = 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 = 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 ];
};
}