ma: make extensive use of defaults for inventory
This commit is contained in:
parent
e437c7d17b
commit
f786e5a22f
@ -5,128 +5,103 @@
|
|||||||
with import <stockholm/lib>;
|
with import <stockholm/lib>;
|
||||||
{ config, ... }: let
|
{ config, ... }: let
|
||||||
|
|
||||||
hostDefaults = hostName: host: flip recursiveUpdate host ({
|
hostDefaults = hostName: host: foldl' recursiveUpdate {} [
|
||||||
|
{
|
||||||
owner = config.krebs.users.makefu;
|
owner = config.krebs.users.makefu;
|
||||||
} // optionalAttrs (host.nets?retiolum) {
|
}
|
||||||
nets.retiolum.ip6.addr =
|
# Retiolum defaults
|
||||||
|
(let
|
||||||
|
pubkey-path = ./retiolum + "/${hostName}.pub";
|
||||||
|
in optionalAttrs (pathExists pubkey-path) {
|
||||||
|
nets.retiolum = {
|
||||||
|
tinc.pubkey = readFile pubkey-path;
|
||||||
|
aliases = [
|
||||||
|
"${hostName}.r"
|
||||||
|
];
|
||||||
|
ip6.addr =
|
||||||
(krebs.genipv6 "retiolum" "makefu" { inherit hostName; }).address;
|
(krebs.genipv6 "retiolum" "makefu" { inherit hostName; }).address;
|
||||||
});
|
};
|
||||||
|
})
|
||||||
|
# Wiregrill defaults
|
||||||
|
(let
|
||||||
|
pubkey-path = ./wiregrill + "/${hostName}.pub";
|
||||||
|
in optionalAttrs (pathExists pubkey-path) {
|
||||||
|
nets.wiregrill = {
|
||||||
|
aliases = [
|
||||||
|
"${hostName}.w"
|
||||||
|
];
|
||||||
|
ip6.addr =
|
||||||
|
(krebs.genipv6 "wiregrill" "makefu" { inherit hostName; }).address;
|
||||||
|
wireguard.pubkey = readFile pubkey-path;
|
||||||
|
};
|
||||||
|
})
|
||||||
|
# SSHD defaults
|
||||||
|
(let
|
||||||
|
pubkey-path = ./sshd + "/${hostName}.pub";
|
||||||
|
in optionalAttrs (pathExists pubkey-path) {
|
||||||
|
ssh.pubkey = readFile pubkey-path;
|
||||||
|
# We assume that if the sshd pubkey exits then there must be a privkey in
|
||||||
|
# the screts store as well
|
||||||
|
ssh.privkey.path = <secrets/ssh_host_ed25519_key>;
|
||||||
|
})
|
||||||
|
host
|
||||||
|
];
|
||||||
|
|
||||||
pub-for = name: builtins.readFile (./ssh + "/${name}.pub");
|
pub-for = name: builtins.readFile (./ssh + "/${name}.pub");
|
||||||
sshd-for = name: builtins.readFile (./sshd + "/${name}.pub");
|
w6 = ip: (krebs.genipv6 "wiregrill" "makefu" ip).address;
|
||||||
tinc-for= name: builtins.readFile (./tinc + "/${name}.pub");
|
|
||||||
|
|
||||||
in {
|
in {
|
||||||
hosts = mapAttrs hostDefaults {
|
hosts = mapAttrs hostDefaults {
|
||||||
cake = rec {
|
cake = rec {
|
||||||
cores = 4;
|
cores = 4;
|
||||||
ci = false;
|
ci = false;
|
||||||
nets = {
|
nets = {
|
||||||
retiolum = {
|
retiolum.ip4.addr = "10.243.136.236";
|
||||||
ip4.addr = "10.243.136.236";
|
|
||||||
aliases = [
|
|
||||||
"cake.r"
|
|
||||||
];
|
|
||||||
tinc.pubkey = tinc-for "cake";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
ssh.privkey.path = <secrets/ssh_host_ed25519_key>;
|
|
||||||
ssh.pubkey = sshd-for "cake";
|
|
||||||
};
|
|
||||||
crapi = rec { # raspi1
|
crapi = rec { # raspi1
|
||||||
cores = 1;
|
cores = 1;
|
||||||
ci = false;
|
ci = false;
|
||||||
nets = {
|
nets = {
|
||||||
retiolum = {
|
retiolum.ip4.addr = "10.243.136.237";
|
||||||
ip4.addr = "10.243.136.237";
|
|
||||||
aliases = [
|
|
||||||
"crapi.r"
|
|
||||||
];
|
|
||||||
tinc.pubkey = tinc-for "crapi";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
ssh.privkey.path = <secrets/ssh.id_ed25519>;
|
|
||||||
ssh.pubkey = sshd-for "crapi";
|
|
||||||
};
|
|
||||||
firecracker = {
|
firecracker = {
|
||||||
cores = 4;
|
cores = 4;
|
||||||
nets = {
|
nets = {
|
||||||
retiolum = {
|
retiolum.ip4.addr = "10.243.12.12";
|
||||||
ip4.addr = "10.243.12.12";
|
|
||||||
ip6.addr = "42:0:0:0:0:0:0:12";
|
|
||||||
aliases = [
|
|
||||||
"firecracker.r"
|
|
||||||
];
|
|
||||||
tinc.pubkey = tinc-for "firecracker";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
ssh.privkey.path = <secrets/ssh.id_ed25519>;
|
|
||||||
ssh.pubkey = sshd-for "firecracker";
|
|
||||||
};
|
|
||||||
|
|
||||||
studio = rec {
|
studio = rec {
|
||||||
ci = false;
|
ci = false;
|
||||||
cores = 4;
|
cores = 4;
|
||||||
ssh.privkey.path = <secrets/ssh_host_ed25519_key>;
|
|
||||||
ssh.pubkey = sshd-for "studio";
|
|
||||||
nets = {
|
nets = {
|
||||||
retiolum = {
|
retiolum.ip4.addr = "10.243.227.163";
|
||||||
ip4.addr = "10.243.227.163";
|
|
||||||
aliases = [
|
|
||||||
"studio.r"
|
|
||||||
];
|
|
||||||
tinc.pubkey = tinc-for "studio";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
fileleech = rec {
|
fileleech = rec {
|
||||||
ci = false;
|
ci = false;
|
||||||
cores = 4;
|
cores = 4;
|
||||||
ssh.privkey.path = <secrets/ssh_host_ed25519_key>;
|
|
||||||
ssh.pubkey = "";
|
|
||||||
nets = {
|
nets = {
|
||||||
retiolum = {
|
retiolum.ip4.addr = "10.243.113.98";
|
||||||
ip4.addr = "10.243.113.98";
|
|
||||||
aliases = [
|
|
||||||
"fileleech.r"
|
|
||||||
];
|
|
||||||
tinc.pubkey = tinc-for "fileleech";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
tsp = {
|
tsp = {
|
||||||
ci = true;
|
ci = true;
|
||||||
cores = 1;
|
cores = 1;
|
||||||
nets = {
|
nets = {
|
||||||
retiolum = {
|
retiolum.ip4.addr = "10.243.0.212";
|
||||||
ip4.addr = "10.243.0.212";
|
|
||||||
aliases = [
|
|
||||||
"tsp.r"
|
|
||||||
];
|
|
||||||
tinc.pubkey = tinc-for "tsp";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
x = {
|
x = {
|
||||||
ci = true;
|
ci = true;
|
||||||
cores = 4;
|
cores = 4;
|
||||||
nets = {
|
nets = {
|
||||||
retiolum = {
|
retiolum.ip4.addr = "10.243.0.91";
|
||||||
ip4.addr = "10.243.0.91";
|
wiregrill = {
|
||||||
aliases = [
|
# defaults
|
||||||
"x.r"
|
|
||||||
];
|
|
||||||
tinc.pubkey = tinc-for "x";
|
|
||||||
};
|
};
|
||||||
#wiregrill = {
|
|
||||||
# aliases = [
|
|
||||||
# "x.w"
|
|
||||||
# ];
|
|
||||||
# wireguard.pubkey = "fe5smvKVy5GAn7EV4w4tav6mqIAKhGWQotm7dRuRt1g=";
|
|
||||||
#};
|
|
||||||
};
|
};
|
||||||
ssh.privkey.path = <secrets/ssh_host_ed25519_key>;
|
|
||||||
ssh.pubkey = sshd-for "x";
|
|
||||||
|
|
||||||
};
|
};
|
||||||
filepimp = rec {
|
filepimp = rec {
|
||||||
@ -139,13 +114,7 @@ in {
|
|||||||
"filepimp.lan"
|
"filepimp.lan"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
retiolum = {
|
retiolum.ip4.addr = "10.243.153.102";
|
||||||
ip4.addr = "10.243.153.102";
|
|
||||||
aliases = [
|
|
||||||
"filepimp.r"
|
|
||||||
];
|
|
||||||
tinc.pubkey = tinc-for "filepimp";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -163,15 +132,11 @@ in {
|
|||||||
retiolum = {
|
retiolum = {
|
||||||
ip4.addr = "10.243.0.89";
|
ip4.addr = "10.243.0.89";
|
||||||
aliases = [
|
aliases = [
|
||||||
"omo.r"
|
|
||||||
"dcpp.omo.r"
|
"dcpp.omo.r"
|
||||||
"torrent.omo.r"
|
"torrent.omo.r"
|
||||||
];
|
];
|
||||||
tinc.pubkey = tinc-for "omo";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
ssh.privkey.path = <secrets/ssh.id_ed25519>;
|
|
||||||
ssh.pubkey = sshd-for "omo";
|
|
||||||
};
|
};
|
||||||
wbob = rec {
|
wbob = rec {
|
||||||
ci = true;
|
ci = true;
|
||||||
@ -180,14 +145,10 @@ in {
|
|||||||
retiolum = {
|
retiolum = {
|
||||||
ip4.addr = "10.243.214.15";
|
ip4.addr = "10.243.214.15";
|
||||||
aliases = [
|
aliases = [
|
||||||
"wbob.r"
|
|
||||||
"hydra.wbob.r"
|
"hydra.wbob.r"
|
||||||
];
|
];
|
||||||
tinc.pubkey = tinc-for "wbob";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
ssh.privkey.path = <secrets/ssh.id_ed25519>;
|
|
||||||
ssh.pubkey = sshd-for "wbob";
|
|
||||||
};
|
};
|
||||||
gum = rec {
|
gum = rec {
|
||||||
ci = true;
|
ci = true;
|
||||||
@ -231,13 +192,16 @@ in {
|
|||||||
"nextgum.i"
|
"nextgum.i"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
#wiregrill = {
|
wiregrill = {
|
||||||
# via = internet;
|
via = internet;
|
||||||
# aliases = [
|
ip6.addr = w6 "1";
|
||||||
# "gum.w"
|
wireguard = {
|
||||||
# ];
|
subnets = [
|
||||||
# wireguard.pubkey = "yAKvxTvcEVdn+MeKsmptZkR3XSEue+wSyLxwcjBYxxo=";
|
(krebs.genipv6 "wiregrill" "external" 0).subnetCIDR
|
||||||
#};
|
(krebs.genipv6 "wiregrill" "makefu" 0).subnetCIDR
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
retiolum = {
|
retiolum = {
|
||||||
via = internet;
|
via = internet;
|
||||||
ip4.addr = "10.243.0.213";
|
ip4.addr = "10.243.0.213";
|
||||||
@ -250,7 +214,6 @@ in {
|
|||||||
"dcpp.gum.r"
|
"dcpp.gum.r"
|
||||||
"dcpp.nextgum.r"
|
"dcpp.nextgum.r"
|
||||||
"graph.r"
|
"graph.r"
|
||||||
"gum.r"
|
|
||||||
"logs.makefu.r"
|
"logs.makefu.r"
|
||||||
"netdata.makefu.r"
|
"netdata.makefu.r"
|
||||||
"nextgum.r"
|
"nextgum.r"
|
||||||
@ -262,25 +225,15 @@ in {
|
|||||||
"wiki.gum.r"
|
"wiki.gum.r"
|
||||||
"wiki.makefu.r"
|
"wiki.makefu.r"
|
||||||
];
|
];
|
||||||
tinc.pubkey = tinc-for "gum";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
ssh.pubkey = sshd-for "gum";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
sdev = rec {
|
sdev = rec {
|
||||||
ci = true;
|
ci = true;
|
||||||
cores = 1;
|
cores = 1;
|
||||||
ssh.privkey.path = <secrets/ssh_host_ed25519_key>;
|
|
||||||
ssh.pubkey = sshd-for "sdev";
|
|
||||||
nets = {
|
nets = {
|
||||||
retiolum = {
|
retiolum.ip4.addr = "10.243.83.237";
|
||||||
ip4.addr = "10.243.83.237";
|
|
||||||
aliases = [
|
|
||||||
"sdev.r"
|
|
||||||
];
|
|
||||||
tinc.pubkey = tinc-for "sdev";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -304,10 +257,6 @@ in {
|
|||||||
};
|
};
|
||||||
retiolum = {
|
retiolum = {
|
||||||
ip4.addr = "10.243.211.172";
|
ip4.addr = "10.243.211.172";
|
||||||
aliases = [
|
|
||||||
"flap.r"
|
|
||||||
];
|
|
||||||
tinc.pubkey = tinc-for "flap";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -317,10 +266,6 @@ in {
|
|||||||
nets = {
|
nets = {
|
||||||
retiolum = {
|
retiolum = {
|
||||||
ip4.addr = "10.243.231.219";
|
ip4.addr = "10.243.231.219";
|
||||||
aliases = [
|
|
||||||
"nukular.r"
|
|
||||||
];
|
|
||||||
tinc.pubkey = tinc-for "nukular";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -330,10 +275,6 @@ in {
|
|||||||
nets = {
|
nets = {
|
||||||
retiolum = {
|
retiolum = {
|
||||||
ip4.addr = "10.243.189.130";
|
ip4.addr = "10.243.189.130";
|
||||||
aliases = [
|
|
||||||
"filebitch.r"
|
|
||||||
];
|
|
||||||
tinc.pubkey = tinc-for "filebitch";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -343,10 +284,6 @@ in {
|
|||||||
nets = {
|
nets = {
|
||||||
retiolum = {
|
retiolum = {
|
||||||
ip4.addr = "10.243.0.163";
|
ip4.addr = "10.243.0.163";
|
||||||
aliases = [
|
|
||||||
"senderechner.r"
|
|
||||||
];
|
|
||||||
tinc.pubkey = tinc-for "senderechner";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
1
krebs/3modules/makefu/wiregrill/gum.pub
Normal file
1
krebs/3modules/makefu/wiregrill/gum.pub
Normal file
@ -0,0 +1 @@
|
|||||||
|
yAKvxTvcEVdn+MeKsmptZkR3XSEue+wSyLxwcjBYxxo=
|
1
krebs/3modules/makefu/wiregrill/x.pub
Normal file
1
krebs/3modules/makefu/wiregrill/x.pub
Normal file
@ -0,0 +1 @@
|
|||||||
|
fe5smvKVy5GAn7EV4w4tav6mqIAKhGWQotm7dRuRt1g=
|
Loading…
Reference in New Issue
Block a user