Refactor network references

master
Sven Slootweg 2 years ago
parent bc4af3390c
commit 11ddc93640

@ -1,4 +1,6 @@
{ let
injectHostnames = builtins.mapAttrs (hostname: attributes: { hostname = hostname; } // attributes);
in injectHostnames {
"machine-workbot-01.cryto.net" = { "machine-workbot-01.cryto.net" = {
friendlyName = "workbot"; friendlyName = "workbot";
ipv4 = "148.251.195.23"; ipv4 = "148.251.195.23";

@ -36,7 +36,9 @@ in {
description = "Cryto"; description = "Cryto";
}; };
"machine-borg2-01.cryto.net" = { pkgs, lib, ... }: { "machine-borg2-01.cryto.net" = let
self = nodes."machine-borg2-01.cryto.net";
in { pkgs, lib, ... }: {
system.stateVersion = "18.09"; system.stateVersion = "18.09";
networking.hostName = "machine-borg2-01"; networking.hostName = "machine-borg2-01";
@ -47,9 +49,9 @@ in {
presets.base presets.base
presets.kvm presets.kvm
./hardware-configurations/machine-borg2-01.nix ./hardware-configurations/machine-borg2-01.nix
(tincConfiguration { hostname = "machine-borg2-01.cryto.net"; nodes = nodes; }) (tincConfiguration { hostname = self.hostname; nodes = nodes; })
(trackSystemMetrics nodes."machine-borg2-01.cryto.net".internalIpv4) (trackSystemMetrics self.internalIpv4)
(trackServiceMetrics nodes."machine-borg2-01.cryto.net".internalIpv4) (trackServiceMetrics self.internalIpv4)
]; ];
boot.loader.grub.device = lib.mkForce "/dev/vda"; boot.loader.grub.device = lib.mkForce "/dev/vda";
@ -101,7 +103,9 @@ in {
}; };
}; };
"machine-haless-03.cryto.net" = { pkgs, lib, config, ... }@args: { "machine-haless-03.cryto.net" = let
self = nodes."machine-haless-03.cryto.net";
in { pkgs, lib, config, ... }@args: {
system.stateVersion = "19.03"; system.stateVersion = "19.03";
networking.hostName = "machine-haless-03"; networking.hostName = "machine-haless-03";
@ -109,9 +113,9 @@ in {
presets.base presets.base
presets.kvm presets.kvm
./hardware-configurations/machine-haless-03.nix ./hardware-configurations/machine-haless-03.nix
(tincConfiguration { hostname = "machine-haless-03.cryto.net"; nodes = nodes; }) (tincConfiguration { hostname = self.hostname; nodes = nodes; })
(trackSystemMetrics nodes."machine-haless-03.cryto.net".internalIpv4) (trackSystemMetrics self.internalIpv4)
(trackServiceMetrics nodes."machine-haless-03.cryto.net".internalIpv4) (trackServiceMetrics self.internalIpv4)
(httpHealthChecks { (httpHealthChecks {
both = [ both = [
"iomfats.cryto.net" "iomfats.cryto.net"
@ -226,7 +230,9 @@ in {
}; };
}; };
"machine-konjassiem-02.cryto.net" = { pkgs, lib, config, ... }@args: { "machine-konjassiem-02.cryto.net" = let
self = nodes."machine-konjassiem-02.cryto.net";
in { pkgs, lib, config, ... }@args: {
system.stateVersion = "20.03"; system.stateVersion = "20.03";
networking.hostName = "machine-konjassiem-02"; networking.hostName = "machine-konjassiem-02";
@ -234,9 +240,9 @@ in {
presets.base presets.base
presets.kvm presets.kvm
./hardware-configurations/machine-konjassiem-02.nix ./hardware-configurations/machine-konjassiem-02.nix
(tincConfiguration { hostname = "machine-konjassiem-02.cryto.net"; nodes = nodes; }) (tincConfiguration { hostname = self.hostname; nodes = nodes; })
(trackSystemMetrics nodes."machine-konjassiem-02.cryto.net".internalIpv4) (trackSystemMetrics self.internalIpv4)
(trackServiceMetrics nodes."machine-konjassiem-02.cryto.net".internalIpv4) (trackServiceMetrics self.internalIpv4)
(httpHealthChecks { (httpHealthChecks {
both = [ "git.cryto.net" ]; both = [ "git.cryto.net" ];
}) })
@ -373,7 +379,9 @@ in {
}; };
}; };
"machine-pikachu-02.cryto.net" = { pkgs, lib, config, ... }@args: { "machine-pikachu-02.cryto.net" = let
self = nodes."machine-pikachu-02.cryto.net";
in { pkgs, lib, config, ... }@args: {
system.stateVersion = "19.03"; system.stateVersion = "19.03";
networking.hostName = "machine-pikachu-02"; networking.hostName = "machine-pikachu-02";
@ -381,20 +389,22 @@ in {
presets.base presets.base
presets.kvm presets.kvm
./hardware-configurations/machine-pikachu-02.nix ./hardware-configurations/machine-pikachu-02.nix
(tincConfiguration { hostname = "machine-pikachu-02.cryto.net"; nodes = nodes; }) (tincConfiguration { hostname = self.hostname; nodes = nodes; })
(trackSystemMetrics nodes."machine-pikachu-02.cryto.net".internalIpv4) (trackSystemMetrics self.internalIpv4)
(trackServiceMetrics nodes."machine-pikachu-02.cryto.net".internalIpv4) (trackServiceMetrics self.internalIpv4)
]; ];
}; };
"machine-workbot-01.cryto.net" = { pkgs, lib, config, ... }@args: { "machine-workbot-01.cryto.net" = let
self = nodes."machine-workbot-01.cryto.net";
in { pkgs, lib, config, ... }@args: {
system.stateVersion = "18.03"; system.stateVersion = "18.03";
networking.hostName = "machine-workbot-01"; networking.hostName = "machine-workbot-01";
imports = [ imports = [
presets.base presets.base
./hardware-configurations/machine-workbot-01.nix ./hardware-configurations/machine-workbot-01.nix
(tincConfiguration { hostname = "machine-workbot-01.cryto.net"; nodes = nodes; }) (tincConfiguration { hostname = self.hostname; nodes = nodes; })
(trackSystemMetrics "127.0.0.1") (trackSystemMetrics "127.0.0.1")
(trackServiceMetrics "127.0.0.1") (trackServiceMetrics "127.0.0.1")
(httpHealthChecks { (httpHealthChecks {

Loading…
Cancel
Save