From 407024dfa9fa68b36bf38589d9010ad46e5866ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Tue, 22 Aug 2023 14:09:41 +0300 Subject: [PATCH] zfsunlock: use IP addresses + zfsunlock --- hosts/hel1-a/configuration.nix | 10 ++++++---- hosts/vno1-oh2/configuration.nix | 10 ++++++---- modules/services/zfsunlock/default.nix | 4 ++++ 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/hosts/hel1-a/configuration.nix b/hosts/hel1-a/configuration.nix index b9b43c3..848423f 100644 --- a/hosts/hel1-a/configuration.nix +++ b/hosts/hel1-a/configuration.nix @@ -83,10 +83,12 @@ zfsunlock = { enable = true; - targets."vno1-oh2.servers.jakst" = { - sshEndpoint = myData.hosts."vno1-oh2.servers.jakst".publicIP; - pingEndpoint = "vno1-oh2.servers.jakst"; - remotePubkey = myData.hosts."vno1-oh2.servers.jakst".initrdPubKey; + targets."vno1-oh2.servers.jakst" = let + host = myData.hosts."vno1-oh2.servers.jakst"; + in { + sshEndpoint = host.publicIP; + pingEndpoint = host.jakstIP; + remotePubkey = host.initrdPubKey; pwFile = config.age.secrets.zfs-passphrase-vno1-oh2.path; startAt = "*-*-* *:00/5:00"; }; diff --git a/hosts/vno1-oh2/configuration.nix b/hosts/vno1-oh2/configuration.nix index 2ea6ec0..144b60f 100644 --- a/hosts/vno1-oh2/configuration.nix +++ b/hosts/vno1-oh2/configuration.nix @@ -114,10 +114,12 @@ zfsunlock = { enable = true; - targets."hel1-a.servers.jakst" = { - sshEndpoint = myData.hosts."hel1-a.servers.jakst".publicIP; - pingEndpoint = "hel1-a.servers.jakst"; - remotePubkey = myData.hosts."hel1-a.servers.jakst".initrdPubKey; + targets."hel1-a.servers.jakst" = let + host = myData.hosts."hel1-a.servers.jakst"; + in { + sshEndpoint = host.publicIP; + pingEndpoint = host.jakstIP; + remotePubkey = host.initrdPubKey; pwFile = config.age.secrets.zfs-passphrase-hel1-a.path; startAt = "*-*-* *:00/5:00"; }; diff --git a/modules/services/zfsunlock/default.nix b/modules/services/zfsunlock/default.nix index 506cd84..d890177 100644 --- a/modules/services/zfsunlock/default.nix +++ b/modules/services/zfsunlock/default.nix @@ -79,5 +79,9 @@ in { } ) config.mj.services.zfsunlock.targets; + + mj.base.unitstatus.units = + map (name: "zfsunlock-${name}") + (builtins.attrNames config.mj.services.zfsunlock.targets); }; }