mirror of https://gitlab.crans.org/nounous/nixos
add info.nix pour les machines physiques
parent
7a4a151ef4
commit
80c51572c2
22
flake.nix
22
flake.nix
|
|
@ -53,12 +53,13 @@
|
||||||
in
|
in
|
||||||
if builtins.pathExists filePath then
|
if builtins.pathExists filePath then
|
||||||
# let eval = evalModules {
|
# let eval = evalModules {
|
||||||
|
# specialArgs = inputs;
|
||||||
# modules = [
|
# modules = [
|
||||||
# # ./modules/crans
|
# ./modules/crans
|
||||||
# {
|
# {
|
||||||
# crans = import filePath;
|
# crans = import filePath;
|
||||||
# }
|
# }
|
||||||
# agenix.nixosModules.default
|
# # agenix.nixosModules.default
|
||||||
# ];
|
# ];
|
||||||
# };
|
# };
|
||||||
# in
|
# in
|
||||||
|
|
@ -79,20 +80,23 @@
|
||||||
map (info:
|
map (info:
|
||||||
{
|
{
|
||||||
name = info.crans.name;
|
name = info.crans.name;
|
||||||
value =
|
value = info;
|
||||||
nixosSystem {
|
|
||||||
specialArgs = inputs;
|
|
||||||
modules = [(path + "/${info.crans.name}")] ++ [info] ++ baseModules
|
|
||||||
;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
) infos)
|
) infos)
|
||||||
;
|
;
|
||||||
|
attrsToNixosSystem = path: all_hosts: hosts:
|
||||||
|
mapAttrs (name: info:
|
||||||
|
nixosSystem {
|
||||||
|
specialArgs = { hosts = all_hosts; inherit inputs;};
|
||||||
|
modules = [(path + "/${name}")] ++ [info] ++ baseModules
|
||||||
|
;
|
||||||
|
}
|
||||||
|
) hosts;
|
||||||
attrs_vm_info = listInfoToAttrs ./hosts/vm hosts_vm_info;
|
attrs_vm_info = listInfoToAttrs ./hosts/vm hosts_vm_info;
|
||||||
attrs_physique_info = listInfoToAttrs ./hosts/physiques hosts_physique_info;
|
attrs_physique_info = listInfoToAttrs ./hosts/physiques hosts_physique_info;
|
||||||
attrs_all_info = attrs_physique_info // attrs_vm_info;
|
attrs_all_info = attrs_physique_info // attrs_vm_info;
|
||||||
in
|
in
|
||||||
attrs_all_info
|
(attrsToNixosSystem ./hosts/vm attrs_all_info attrs_vm_info)
|
||||||
//
|
//
|
||||||
{
|
{
|
||||||
cransIso = nixosSystem {
|
cransIso = nixosSystem {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
{
|
||||||
|
name = "cameron";
|
||||||
|
description = "Serveur de stockage adh";
|
||||||
|
id = 2;
|
||||||
|
|
||||||
|
isDebian = true;
|
||||||
|
|
||||||
|
networking = {
|
||||||
|
adm.enable = true;
|
||||||
|
san.enable = true;
|
||||||
|
|
||||||
|
switch = {
|
||||||
|
# todo recheck port
|
||||||
|
salameche = -1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
ilo = {
|
||||||
|
id = 52;
|
||||||
|
switch.salameche = 16;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
name = "cephiroth";
|
||||||
|
description = "Serveur de stockage ceph";
|
||||||
|
id = 3;
|
||||||
|
|
||||||
|
networking = {
|
||||||
|
adm.enable = true;
|
||||||
|
san.enable = true;
|
||||||
|
|
||||||
|
switch = {
|
||||||
|
carapuce = 12;
|
||||||
|
arceus = 12;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
ilo = {
|
||||||
|
id = 53;
|
||||||
|
switch.salameche = 20;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
{
|
||||||
|
name = "daniel";
|
||||||
|
description = "PVE adm";
|
||||||
|
id = 12;
|
||||||
|
|
||||||
|
isDebian = true;
|
||||||
|
|
||||||
|
networking = {
|
||||||
|
adm.enable = true;
|
||||||
|
san.enable = true;
|
||||||
|
srv-nat.enable = true;
|
||||||
|
|
||||||
|
switch = {
|
||||||
|
carapuce = 3;
|
||||||
|
arceus = 3;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
ilo = {
|
||||||
|
id = 22;
|
||||||
|
switch.salameche = 4;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
name = "ft";
|
||||||
|
description = "Serveur de backup du Crans, en SQ39";
|
||||||
|
id = 15;
|
||||||
|
|
||||||
|
isDebian = true;
|
||||||
|
|
||||||
|
networking = {
|
||||||
|
adm.enable = true;
|
||||||
|
|
||||||
|
switch = {
|
||||||
|
carapuce = 13;
|
||||||
|
arceus = 13;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
{
|
||||||
|
name = "gulp";
|
||||||
|
description = "PVE adh";
|
||||||
|
id = 18;
|
||||||
|
|
||||||
|
isDebian = true;
|
||||||
|
|
||||||
|
networking = {
|
||||||
|
adm.enable = true;
|
||||||
|
adh.enable = true;
|
||||||
|
|
||||||
|
switch = {
|
||||||
|
carapuce = 11;
|
||||||
|
arceus = 11;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
ilo = {
|
||||||
|
id = 28;
|
||||||
|
switch.salameche = 12;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
{
|
||||||
|
name = "jack";
|
||||||
|
description = "PVE adm";
|
||||||
|
id = 13;
|
||||||
|
|
||||||
|
isDebian = true;
|
||||||
|
|
||||||
|
networking = {
|
||||||
|
adm.enable = true;
|
||||||
|
san.enable = true;
|
||||||
|
srv-nat.enable = true;
|
||||||
|
|
||||||
|
switch = {
|
||||||
|
carapuce = 5;
|
||||||
|
arceus = 5;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
ilo = {
|
||||||
|
id = 23;
|
||||||
|
switch.salameche = 6;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
{
|
||||||
|
name = "odlyd";
|
||||||
|
description = "PVE adh";
|
||||||
|
id = 16;
|
||||||
|
|
||||||
|
isDebian = true;
|
||||||
|
|
||||||
|
networking = {
|
||||||
|
adm.enable = true;
|
||||||
|
adh.enable = true;
|
||||||
|
|
||||||
|
switch = {
|
||||||
|
# pas branche
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
ilo = {
|
||||||
|
id = 26;
|
||||||
|
switch.salameche = 8;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
{
|
||||||
|
name = "sam";
|
||||||
|
description = "PVE adm";
|
||||||
|
id = 11;
|
||||||
|
|
||||||
|
isDebian = true;
|
||||||
|
|
||||||
|
networking = {
|
||||||
|
adm.enable = true;
|
||||||
|
san.enable = true;
|
||||||
|
srv-nat.enable = true;
|
||||||
|
|
||||||
|
switch = {
|
||||||
|
carapuce = 1;
|
||||||
|
arceus = 1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
ilo = {
|
||||||
|
id = 21;
|
||||||
|
switch.salameche = 2;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
{
|
||||||
|
name = "stitch";
|
||||||
|
description = "PVE adh";
|
||||||
|
id = 17;
|
||||||
|
|
||||||
|
isDebian = true;
|
||||||
|
|
||||||
|
networking = {
|
||||||
|
adm.enable = true;
|
||||||
|
adh.enable = true;
|
||||||
|
|
||||||
|
switch = {
|
||||||
|
carapuce = 9;
|
||||||
|
arceus = 9;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
ilo = {
|
||||||
|
id = 27;
|
||||||
|
switch.salameche = 10;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
{
|
||||||
|
name = "tealc";
|
||||||
|
description = "Serveur de stockage adm";
|
||||||
|
id = 1;
|
||||||
|
|
||||||
|
isDebian = true;
|
||||||
|
|
||||||
|
networking = {
|
||||||
|
adm.enable = true;
|
||||||
|
san.enable = true;
|
||||||
|
|
||||||
|
switch = {
|
||||||
|
carapuce = 10;
|
||||||
|
arceus = 10;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
ilo = {
|
||||||
|
id = 51;
|
||||||
|
switch.salameche = 18;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
{
|
||||||
|
name = "zamok";
|
||||||
|
description = "Serveur de calcul adhérent";
|
||||||
|
id = 31;
|
||||||
|
|
||||||
|
isDebian = true;
|
||||||
|
|
||||||
|
networking = {
|
||||||
|
adm.enable = true;
|
||||||
|
adh.enable = true;
|
||||||
|
san.enable = true;
|
||||||
|
|
||||||
|
switch = {
|
||||||
|
carapuce = 7;
|
||||||
|
arceus = 4;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
ilo = {
|
||||||
|
id = 54;
|
||||||
|
switch.salameche = 14;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
id = 163;
|
id = 163;
|
||||||
|
|
||||||
networking = {
|
networking = {
|
||||||
|
adm.enable = true;
|
||||||
srv = {
|
srv = {
|
||||||
enable = true;
|
enable = true;
|
||||||
ipv4 = "185.230.79.15";
|
ipv4 = "185.230.79.15";
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
{ lib, config, ... }:
|
{ lib, config, hosts, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.crans;
|
cfg = config.crans;
|
||||||
|
|
@ -9,6 +9,7 @@ let
|
||||||
mkIf
|
mkIf
|
||||||
mkOption
|
mkOption
|
||||||
types
|
types
|
||||||
|
mod
|
||||||
;
|
;
|
||||||
|
|
||||||
idString = toString cfg.id;
|
idString = toString cfg.id;
|
||||||
|
|
@ -16,6 +17,8 @@ let
|
||||||
hostIdString = lib.fixedWidthString 2 "0" (toString hostId);
|
hostIdString = lib.fixedWidthString 2 "0" (toString hostId);
|
||||||
isVm = cfg.id >= 100;
|
isVm = cfg.id >= 100;
|
||||||
isVmString = toString isVm;
|
isVmString = toString isVm;
|
||||||
|
get_mac = id: vlan_num:
|
||||||
|
"02:00:00:0${toString (id >= 100)}:${toString (mod id 100)}:${toString vlan_num}";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.crans.networking = {
|
options.crans.networking = {
|
||||||
|
|
@ -30,6 +33,21 @@ in
|
||||||
example = "ens20";
|
example = "ens20";
|
||||||
description = "Nom de l'interface réseau sur laquelle est située le VLAN adm.";
|
description = "Nom de l'interface réseau sur laquelle est située le VLAN adm.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ipv4 = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
example = "176.16.10.102";
|
||||||
|
default = "172.16.10.${idString}";
|
||||||
|
description = "Adresse IPv4 de la machine sur le VLAN adm";
|
||||||
|
};
|
||||||
|
|
||||||
|
ipv6 = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
example = "fd00::10:0:ff:fe01:0210";
|
||||||
|
default = "fd00::10:0:ff:fe0${isVmString}:${hostIdString}10";
|
||||||
|
description = "Adresse IPv6 de la machine sur le VLAN adm";
|
||||||
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
srv = {
|
srv = {
|
||||||
|
|
@ -47,6 +65,13 @@ in
|
||||||
example = "185.230.79.1";
|
example = "185.230.79.1";
|
||||||
description = "Adresse IPv4 de la machine.";
|
description = "Adresse IPv4 de la machine.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ipv6 = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
example = "2a0c:700:2::ff:fe01:0202";
|
||||||
|
default = "2a0c:700:2::ff:fe0${isVmString}:${hostIdString}02";
|
||||||
|
description = "Adresse IPv6 de la machine sur le VLAN srv.";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
srvNat = {
|
srvNat = {
|
||||||
|
|
@ -58,6 +83,20 @@ in
|
||||||
example = "ens20";
|
example = "ens20";
|
||||||
description = "Nom de l'interface réseau sur laquelle est située le VLAN srv-nat.";
|
description = "Nom de l'interface réseau sur laquelle est située le VLAN srv-nat.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ipv4 = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
example = "176.16.3.102";
|
||||||
|
default = "172.16.3.${idString}";
|
||||||
|
description = "Adresse IPv4 de la machine sur le VLAN srv-nat.";
|
||||||
|
};
|
||||||
|
|
||||||
|
ipv6 = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
example = "2a0c:700:3::ff:fe01:0203";
|
||||||
|
default = "2a0c:700:3::ff:fe0${isVmString}:${hostIdString}03";
|
||||||
|
description = "Adresse IPv6 de la machine sur le VLAN srv-nat.";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
san = {
|
san = {
|
||||||
|
|
@ -68,6 +107,20 @@ in
|
||||||
example = "ens19";
|
example = "ens19";
|
||||||
description = "Nom de l'interface réseau sur laquelle est située le VLAN san.";
|
description = "Nom de l'interface réseau sur laquelle est située le VLAN san.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ipv4 = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
example = "176.16.4.102";
|
||||||
|
default = "172.16.4.${idString}";
|
||||||
|
description = "Adresse IPv4 de la machine sur le VLAN srv-nat.";
|
||||||
|
};
|
||||||
|
|
||||||
|
ipv6 = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
example = "fd00::4:0:ff:fe01:0204";
|
||||||
|
default = "fd00::4:0:ff:fe0${isVmString}:${hostIdString}04";
|
||||||
|
description = "Adresse IPv6 de la machine sur le VLAN san.";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -98,14 +151,14 @@ in
|
||||||
adm = {
|
adm = {
|
||||||
ipv4.addresses = [
|
ipv4.addresses = [
|
||||||
{
|
{
|
||||||
address = "172.16.10.${idString}";
|
address = cfg-net.adm.ipv4;
|
||||||
prefixLength = 24;
|
prefixLength = 24;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
ipv6.addresses = [
|
ipv6.addresses = [
|
||||||
{
|
{
|
||||||
address = "fd00::10:0:ff:fe0${isVmString}:${hostIdString}10";
|
address = cfg-net.adm.ipv6;
|
||||||
prefixLength = 64;
|
prefixLength = 64;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
@ -131,7 +184,7 @@ in
|
||||||
ipv6 = {
|
ipv6 = {
|
||||||
addresses = [
|
addresses = [
|
||||||
{
|
{
|
||||||
address = "2a0c:700:2::ff:fe0${isVmString}:${hostIdString}02";
|
address = cfg-net.srv.ipv6;
|
||||||
prefixLength = 64;
|
prefixLength = 64;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
@ -150,7 +203,7 @@ in
|
||||||
ipv4 = {
|
ipv4 = {
|
||||||
addresses = [
|
addresses = [
|
||||||
{
|
{
|
||||||
address = "172.16.3.${idString}";
|
address = cfg-net.srvNat.ipv4;
|
||||||
prefixLength = 24;
|
prefixLength = 24;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
@ -166,7 +219,7 @@ in
|
||||||
ipv6 = {
|
ipv6 = {
|
||||||
addresses = [
|
addresses = [
|
||||||
{
|
{
|
||||||
address = "2a0c:700:3::ff:fe0${isVmString}:${hostIdString}03";
|
address = cfg-net.srvNat.ipv6;
|
||||||
prefixLength = 64;
|
prefixLength = 64;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
@ -184,14 +237,14 @@ in
|
||||||
san = {
|
san = {
|
||||||
ipv4.addresses = [
|
ipv4.addresses = [
|
||||||
{
|
{
|
||||||
address = "172.16.4.${idString}";
|
address = cfg-net.san.ipv4;
|
||||||
prefixLength = 24;
|
prefixLength = 24;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
ipv6.addresses = [
|
ipv6.addresses = [
|
||||||
{
|
{
|
||||||
address = "fd00::4:0:ff:fe0${isVmString}:${hostIdString}04";
|
address = cfg-net.san.ipv6;
|
||||||
prefixLength = 64;
|
prefixLength = 64;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ in
|
||||||
|
|
||||||
root = {
|
root = {
|
||||||
passwordFile = mkOption {
|
passwordFile = mkOption {
|
||||||
type = types.path;
|
type = types.externalPath;
|
||||||
default = ../../secrets/common/root.age;
|
default = ../../secrets/common/root.age;
|
||||||
example = ../../secrets/apprentix/root.age;
|
example = ../../secrets/apprentix/root.age;
|
||||||
description = "Fichier chiffré par age contenant le mot de passe root.";
|
description = "Fichier chiffré par age contenant le mot de passe root.";
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue