2023-07-20 12:32:31 +02:00
|
|
|
let
|
2024-02-02 10:51:31 +01:00
|
|
|
mkDefaultInterface =
|
|
|
|
_: attrs:
|
|
|
|
{
|
|
|
|
ipv4 = [ ];
|
|
|
|
ipv6 = [ ];
|
|
|
|
gateways = [ ];
|
|
|
|
}
|
|
|
|
// attrs;
|
|
|
|
|
|
|
|
mkBase =
|
|
|
|
config: config // { interfaces = builtins.mapAttrs mkDefaultInterface (config.interfaces or { }); };
|
2023-07-20 12:32:31 +02:00
|
|
|
|
|
|
|
getAddresses = version: interface: builtins.map (builtins.getAttr "address") interface.${version};
|
|
|
|
|
2023-07-21 00:37:05 +02:00
|
|
|
filterIPv4 = ip: builtins.substring 0 7 ip != "192.168";
|
|
|
|
filterIPv6 = _: true;
|
|
|
|
|
2024-02-02 10:51:31 +01:00
|
|
|
mkNet =
|
|
|
|
_: value:
|
|
|
|
let
|
|
|
|
base = mkBase value;
|
|
|
|
in
|
|
|
|
base
|
|
|
|
// {
|
2023-07-20 12:32:31 +02:00
|
|
|
addresses =
|
|
|
|
let
|
2024-02-02 10:51:31 +01:00
|
|
|
_addresses =
|
|
|
|
builtins.foldl'
|
|
|
|
(
|
|
|
|
{ ipv4, ipv6 }:
|
|
|
|
net: {
|
|
|
|
ipv4 = ipv4 ++ getAddresses "ipv4" net;
|
|
|
|
ipv6 = ipv6 ++ getAddresses "ipv6" net;
|
|
|
|
}
|
|
|
|
)
|
|
|
|
{
|
|
|
|
ipv4 = [ ];
|
|
|
|
ipv6 = [ ];
|
|
|
|
}
|
|
|
|
(builtins.attrValues base.interfaces);
|
2023-07-20 12:32:31 +02:00
|
|
|
in
|
2024-02-02 10:51:31 +01:00
|
|
|
_addresses
|
|
|
|
// rec {
|
2023-07-21 00:37:05 +02:00
|
|
|
publicV4 = builtins.filter filterIPv4 _addresses.ipv4;
|
|
|
|
publicV6 = builtins.filter filterIPv6 _addresses.ipv6;
|
|
|
|
public = publicV4 ++ publicV6;
|
2023-07-20 12:32:31 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
in
|
|
|
|
|
|
|
|
builtins.mapAttrs mkNet {
|
|
|
|
compute01 = {
|
|
|
|
interfaces = {
|
|
|
|
eno1 = {
|
|
|
|
ipv4 = [
|
2024-02-02 10:51:31 +01:00
|
|
|
{
|
|
|
|
address = "129.199.146.147";
|
|
|
|
prefixLength = 24;
|
|
|
|
}
|
|
|
|
{
|
|
|
|
address = "192.168.1.147";
|
|
|
|
prefixLength = 24;
|
|
|
|
}
|
2023-07-20 12:32:31 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
gateways = [ "129.199.146.254" ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
hostId = "8df60941";
|
|
|
|
};
|
|
|
|
|
2024-02-20 17:47:50 +01:00
|
|
|
geo01 = {
|
|
|
|
interfaces = {
|
|
|
|
eno1 = {
|
|
|
|
ipv4 = [
|
|
|
|
{
|
|
|
|
address = "129.199.210.194";
|
|
|
|
prefixLength = 24;
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
gateways = [ "129.199.210.254" ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
hostId = "b88fee0c";
|
|
|
|
|
|
|
|
dns = [
|
|
|
|
"129.199.96.11"
|
|
|
|
"129.199.72.99"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2024-02-20 17:57:38 +01:00
|
|
|
geo02 = {
|
|
|
|
interfaces = {
|
|
|
|
eno1 = {
|
|
|
|
ipv4 = [
|
|
|
|
{
|
|
|
|
address = "129.199.210.69";
|
|
|
|
prefixLength = 24;
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
gateways = [ "129.199.210.254" ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
hostId = "45d65237";
|
|
|
|
|
|
|
|
dns = [
|
|
|
|
"129.199.96.11"
|
|
|
|
"129.199.72.99"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2023-07-20 12:32:31 +02:00
|
|
|
storage01 = {
|
|
|
|
interfaces = {
|
|
|
|
eno1 = {
|
|
|
|
ipv4 = [
|
2024-02-02 10:51:31 +01:00
|
|
|
{
|
|
|
|
address = "129.199.146.148";
|
|
|
|
prefixLength = 24;
|
|
|
|
}
|
|
|
|
{
|
|
|
|
address = "192.168.1.148";
|
|
|
|
prefixLength = 24;
|
|
|
|
}
|
2023-07-20 12:32:31 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
gateways = [ "129.199.146.254" ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
hostId = "d4e7c369";
|
|
|
|
};
|
|
|
|
|
2024-01-10 15:00:18 +01:00
|
|
|
vault01 = {
|
|
|
|
interfaces = {
|
|
|
|
enp130s0f0 = {
|
|
|
|
ipv4 = [
|
2024-02-02 10:51:31 +01:00
|
|
|
{
|
|
|
|
address = "129.199.210.85";
|
|
|
|
prefixLength = 24;
|
|
|
|
}
|
2024-01-10 15:00:18 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
gateways = [ "129.199.210.254" ];
|
2024-02-21 17:17:16 +01:00
|
|
|
|
|
|
|
DHCP = "ipv4";
|
2024-01-10 15:00:18 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
hostId = "e83b600d";
|
|
|
|
};
|
|
|
|
|
2023-07-20 12:32:31 +02:00
|
|
|
web01 = {
|
|
|
|
interfaces = {
|
|
|
|
ens3 = {
|
2024-02-02 10:51:31 +01:00
|
|
|
ipv4 = [
|
|
|
|
{
|
|
|
|
address = "129.199.129.53";
|
|
|
|
prefixLength = 24;
|
|
|
|
}
|
|
|
|
];
|
2023-07-20 12:32:31 +02:00
|
|
|
|
|
|
|
gateways = [ "129.199.129.1" ];
|
|
|
|
};
|
|
|
|
};
|
2023-07-20 15:48:01 +02:00
|
|
|
|
|
|
|
hostId = "050df79e";
|
2023-07-20 12:32:31 +02:00
|
|
|
};
|
2024-01-11 12:45:01 +01:00
|
|
|
|
|
|
|
web02 = {
|
|
|
|
interfaces = {
|
|
|
|
ens3 = {
|
2024-02-02 10:51:31 +01:00
|
|
|
ipv4 = [
|
|
|
|
{
|
|
|
|
address = "129.199.129.235";
|
|
|
|
prefixLength = 24;
|
|
|
|
}
|
|
|
|
];
|
2024-01-11 12:45:01 +01:00
|
|
|
|
|
|
|
gateways = [ "129.199.129.1" ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
hostId = "b431ca10";
|
|
|
|
};
|
2024-02-21 01:44:48 +01:00
|
|
|
|
|
|
|
rescue01 = {
|
|
|
|
interfaces = {
|
|
|
|
ens18 = {
|
|
|
|
ipv6 = [
|
|
|
|
{
|
|
|
|
address = "2a01:e0a:de4:a0e1:2d73:2a7e:18db:5728";
|
|
|
|
prefixLength = 64;
|
|
|
|
}
|
|
|
|
];
|
|
|
|
ipv4 = [
|
|
|
|
{
|
|
|
|
address = "192.168.0.232";
|
|
|
|
prefixLength = 21;
|
|
|
|
}
|
|
|
|
];
|
|
|
|
gateways = [ "192.168.0.1" ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
hostId = "007f0200";
|
|
|
|
};
|
2023-07-20 12:32:31 +02:00
|
|
|
}
|