Tom Hubrecht
2c88c2bad7
All checks were successful
build configuration / build_web02 (push) Successful in 1m16s
build configuration / build_storage01 (push) Successful in 1m18s
build configuration / build_compute01 (push) Successful in 1m21s
build configuration / build_vault01 (push) Successful in 1m22s
build configuration / build_web01 (push) Successful in 1m38s
lint / check (push) Successful in 25s
build configuration / build_rescue01 (push) Successful in 56s
build configuration / push_to_cache (push) Successful in 2m13s
Re-enable the service on vault01 now that it works
56 lines
1.3 KiB
Nix
56 lines
1.3 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
nodeMeta,
|
|
...
|
|
}:
|
|
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 {
|
|
nixpkgs.overlays = [
|
|
(_: super: {
|
|
netbox-agent = super.netbox-agent.overrideAttrs (old: {
|
|
patches = (old.patches or [ ]) ++ [ ./01-batch-filter.patch ];
|
|
});
|
|
})
|
|
];
|
|
|
|
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 = [ ./. ];
|
|
};
|
|
}
|