Skip to content

Commit f6e1e95

Browse files
[READY] wasgeht 0.3.0 (#1109)
2 parents b926d2b + a14d8da commit f6e1e95

File tree

5 files changed

+170
-22
lines changed

5 files changed

+170
-22
lines changed

facts/inventory.py

Lines changed: 159 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -425,12 +425,10 @@ def serveralias(name):
425425
match name.lower():
426426
case "core-expo":
427427
payload = [
428-
"core-slave",
429428
"ntpexpo",
430429
]
431430
case "core-conf":
432431
payload = [
433-
"core-master",
434432
"loghost",
435433
"monitoring",
436434
"ntpconf",
@@ -1020,22 +1018,170 @@ def generatezones(switches, routers, pis, aps, servers, outputdir):
10201018
def generatewasgehtconfig(switches, routers, pis, aps, servers, outputdir):
10211019
wasgehtconfig = {}
10221020
for switch in switches:
1023-
wasgehtconfig[switch["name"]] = {"address": switch["ipv6"]}
1021+
entry = {
1022+
"tags": {
1023+
"type": "switch",
1024+
"os": "junos",
1025+
"num": switch["num"],
1026+
**(
1027+
{"aliases": ", ".join(switch["aliases"])}
1028+
if switch["aliases"]
1029+
else {}
1030+
),
1031+
},
1032+
"checks": {
1033+
"ping": {
1034+
"addresses": [switch["ipv6"]],
1035+
},
1036+
},
1037+
}
1038+
wasgehtconfig[switch["name"]] = entry
10241039
for router in routers:
1025-
wasgehtconfig[router["name"]] = {"address": router["ipv6"]}
1040+
if router["name"] == "br-mdf-01":
1041+
ping_addresses = [
1042+
"172.20.1.1",
1043+
"2001:470:f026:901::1",
1044+
"10.0.3.2",
1045+
"2001:470:f026:103::2",
1046+
"172.20.4.1",
1047+
"2001:470:f026:104::1",
1048+
]
1049+
elif router["name"] == "ex-mdf-01":
1050+
ping_addresses = [
1051+
"172.20.4.3",
1052+
"2001:470:f026:104::3",
1053+
"172.20.3.3",
1054+
"2001:470:f026:903::3",
1055+
"10.0.3.1",
1056+
"2001:470:f026:103::1",
1057+
]
1058+
elif router["name"] == "cf-mdf-01":
1059+
ping_addresses = [
1060+
"172.20.1.2",
1061+
"2001:470:f026:901::2",
1062+
"172.20.3.2",
1063+
"2001:470:f026:903::2",
1064+
"10.128.3.1",
1065+
"2001:470:f026:503::1",
1066+
]
1067+
else:
1068+
ping_addresses = [router["ipv6"]]
1069+
wasgehtconfig[router["name"]] = {
1070+
"tags": {
1071+
"type": "router",
1072+
"os": "nixos",
1073+
},
1074+
"checks": {
1075+
"ping": {
1076+
"addresses": ping_addresses,
1077+
},
1078+
},
1079+
}
10261080
for pi in pis:
1027-
wasgehtconfig[pi["name"]] = {"address": pi["ipv6"]}
1081+
wasgehtconfig[pi["name"]] = {
1082+
"tags": {
1083+
"type": "pi",
1084+
"os": "nixos",
1085+
"role": "registration" if pi["name"].startswith("pi-reg") else "sign",
1086+
},
1087+
"checks": {
1088+
"ping": {
1089+
"addresses": [pi["ipv6"]],
1090+
},
1091+
},
1092+
}
10281093
for ap in aps:
1029-
wasgehtconfig[ap["name"]] = {"address": ap["ipv4"]}
1094+
wasgehtconfig[ap["name"]] = {
1095+
"tags": {
1096+
"type": "ap",
1097+
"os": "openwrt",
1098+
"channels": f"{ap['wifi2']} / {ap['wifi5']}",
1099+
"config": ap["configver"],
1100+
**({"aliases": ", ".join(ap["aliases"])} if ap["aliases"] else {}),
1101+
},
1102+
"checks": {
1103+
"ping": {
1104+
"addresses": [ap["ipv4"]],
1105+
},
1106+
"wifi_stations": {
1107+
"address": ap["ipv4"],
1108+
"radios": ["phy0-ap0", "phy1-ap0"],
1109+
},
1110+
},
1111+
}
10301112
for server in servers:
1031-
wasgehtconfig[server["name"]] = {"address": server["ipv6"]}
1032-
wasgehtconfig["google88v6"] = {"address": "2001:4860:4860::8888"}
1033-
wasgehtconfig["google88v4"] = {"address": "8.8.8.8"}
1034-
wasgehtconfig["google44v6"] = {"address": "2001:4860:4860::8844"}
1035-
wasgehtconfig["google44v4"] = {"address": "8.8.4.4"}
1036-
wasgehtconfig["localhost"] = {"address": "::1"}
1113+
wasgehtconfig[server["name"]] = {
1114+
"tags": {
1115+
"type": "server",
1116+
"os": "nixos",
1117+
"role": server["role"],
1118+
"building": server["building"],
1119+
**(
1120+
{"aliases": ", ".join(server["aliases"])}
1121+
if server["aliases"]
1122+
else {}
1123+
),
1124+
},
1125+
"checks": {
1126+
"ping": {
1127+
"addresses": [server["ipv6"], server["ipv4"]],
1128+
},
1129+
**(
1130+
{
1131+
"dns": {
1132+
"server": f"{server['ipv4']}:53",
1133+
"queries": [
1134+
{
1135+
"name": server["fqdn"],
1136+
"type": "A",
1137+
"expect": server["ipv4"],
1138+
},
1139+
{
1140+
"name": server["ipv4ptr"],
1141+
"type": "PTR",
1142+
"expect": server["fqdn"],
1143+
},
1144+
{
1145+
"name": server["ipv6ptr"],
1146+
"type": "PTR",
1147+
"expect": server["fqdn"],
1148+
},
1149+
{
1150+
"name": server["fqdn"],
1151+
"type": "AAAA",
1152+
"expect": server["ipv6"],
1153+
},
1154+
{
1155+
"name": "a.root-servers.net",
1156+
"type": "AAAA",
1157+
"expect": "2001:503:ba3e::2:30",
1158+
},
1159+
],
1160+
}
1161+
}
1162+
if server["role"] == "core"
1163+
else {}
1164+
),
1165+
**(
1166+
{
1167+
"http": {
1168+
"urls": [
1169+
f"https://{server['fqdn']}/grafana/",
1170+
f"https://{server['fqdn']}/loki/",
1171+
f"https://{server['fqdn']}/mimir/",
1172+
f"https://{server['fqdn']}/tempo/",
1173+
f"http://{server['fqdn']}:1982",
1174+
],
1175+
"skip_verify": True,
1176+
}
1177+
}
1178+
if server["name"] == "core-conf"
1179+
else {}
1180+
),
1181+
},
1182+
}
10371183
with open(f"{outputdir}/scale-wasgeht-config.json", "w") as f:
1038-
json.dump(wasgehtconfig, f)
1184+
json.dump(wasgehtconfig, f, indent=2)
10391185

10401186

10411187
def generateallnetwork(switches, routers, outputdir):

facts/servers/serverlist.csv

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
name,mac-address,ipv6,ipv4,role
22
core-expo,58:9c:fc:00:38:5f,2001:470:f026:103::20,10.0.3.20,core
33
core-conf,4c:72:b9:7c:41:17,2001:470:f026:503::20,10.128.3.20,core
4-
mrtg,52:54:00:d4:fa:5d,2001:470:f026:503::21,10.128.3.21,mrtg
5-
ctfweb,52:54:00:31:a4:fa,2001:470:f026:503::22,10.128.3.22,ctfweb
6-
wireguard,52:54:00:61:c6:f9,2001:470:f026:103::23,10.0.3.23,wireguard

nix/nixos-modules/routers/conference.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ in
292292
matchConfig.Name = "bridge502";
293293
enable = true;
294294
address = [
295-
"10.128.2.1/21"
295+
"10.128.2.1/24"
296296
"2001:470:f026:502::1/64"
297297
];
298298
};

nix/nixos-modules/services/bind-master.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ let
3030
header = ''
3131
$ORIGIN scale.lan.
3232
$TTL 86400
33-
@ IN SOA core-slave.scale.lan. admin.scale.lan. (
33+
@ IN SOA core-expo.scale.lan. admin.scale.lan. (
3434
${zoneSerial} ; serial number
3535
3600 ; refresh
3636
900 ; retry

nix/package-sets/top-level/scale-network/wasgeht/package.nix

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,23 @@
55
makeWrapper,
66
unixtools,
77
rrdtool,
8+
go_1_25,
89
}:
910

10-
buildGoModule rec {
11+
buildGoModule.override { go = go_1_25; } rec {
1112
pname = "wasgeht";
12-
version = "0.2.0";
13+
version = "0.3.0";
1314

1415
src = fetchFromGitHub {
1516
owner = "kylerisse";
1617
repo = "wasgeht";
1718
rev = "refs/tags/${version}";
18-
hash = "sha256-+KLjVt5WKcngFCGyQTIoNJVKprn/7fyAiNLkxW6onN0=";
19+
hash = "sha256-Yi+35tCe8mnZqs87rBGu8eGhMEPGdvieq0j/6DIh9Ho=";
1920
};
2021

2122
strictDeps = true;
2223

23-
vendorHash = "sha256-0HDZ3llIgLMxRLNei93XrcYliBzjajU6ZPllo3/IZVY=";
24+
vendorHash = "sha256-EGGsQUqGzbQvyO6nymkG/FR/9IZXAUcmGriRFuwNPMc=";
2425

2526
ldflags = [
2627
"-s"
@@ -33,6 +34,10 @@ buildGoModule rec {
3334
rrdtool
3435
];
3536

37+
checkPhase = ''
38+
go test --short --race -v ./...
39+
'';
40+
3641
postFixup = ''
3742
wrapProgram $out/bin/wasgehtd --set PATH ${
3843
lib.makeBinPath [

0 commit comments

Comments
 (0)