forked from DGNum/infrastructure
feat(netbox-agent): init
This commit is contained in:
parent
733c9c74a7
commit
747d8c08cb
7 changed files with 165 additions and 0 deletions
48
modules/dgn-netbox-agent/default.nix
Normal file
48
modules/dgn-netbox-agent/default.nix
Normal file
|
@ -0,0 +1,48 @@
|
|||
{
|
||||
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 = [ ./. ];
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue