forked from clan/clan-infra
add new baremetal server
This commit is contained in:
parent
53215d788d
commit
cbc7de9d07
@ -24,3 +24,10 @@ creation_rules:
|
|||||||
- *lassulus
|
- *lassulus
|
||||||
- *dave
|
- *dave
|
||||||
- *web01
|
- *web01
|
||||||
|
- path_regex: targets/web01-new/secrets.yaml$
|
||||||
|
key_groups:
|
||||||
|
- age:
|
||||||
|
- *joerg
|
||||||
|
- *lassulus
|
||||||
|
- *dave
|
||||||
|
- *web01
|
||||||
|
@ -10,6 +10,13 @@
|
|||||||
./single-disk.nix
|
./single-disk.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
|
hetzner-ex101.imports = [
|
||||||
|
inputs.srvos.nixosModules.hardware-hetzner-online-intel
|
||||||
|
./xfs-lvm-crypto-raid.nix
|
||||||
|
./hetzner-ex101.nix
|
||||||
|
./initrd-networking.nix
|
||||||
|
];
|
||||||
|
|
||||||
web01.imports = [
|
web01.imports = [
|
||||||
self.nixosModules.server
|
self.nixosModules.server
|
||||||
inputs.srvos.nixosModules.mixins-nginx
|
inputs.srvos.nixosModules.mixins-nginx
|
||||||
|
8
modules/hetzner-ex101.nix
Normal file
8
modules/hetzner-ex101.nix
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
# Enable raid support specifically, this will disable srvos's
|
||||||
|
# systemd-initrd as well, which currently is not compatible with mdraid.
|
||||||
|
boot.initrd.services.swraid.enable = true;
|
||||||
|
systemd.services.mdmonitor.enable = false;
|
||||||
|
boot.loader.systemd-boot.enable = true;
|
||||||
|
boot.loader.efi.canTouchEfiVariables = true;
|
||||||
|
}
|
69
modules/initrd-networking.nix
Normal file
69
modules/initrd-networking.nix
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
{ config
|
||||||
|
, lib
|
||||||
|
, ...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.clan.networking;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options = {
|
||||||
|
clan.networking.ipv4.address = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
};
|
||||||
|
|
||||||
|
clan.networking.ipv4.cidr = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "26";
|
||||||
|
};
|
||||||
|
|
||||||
|
clan.networking.ipv4.gateway = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
};
|
||||||
|
|
||||||
|
clan.networking.ipv6.address = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
};
|
||||||
|
|
||||||
|
clan.networking.ipv6.cidr = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "64";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
# Hack so that network is considered up by boot.initrd.network and postCommands gets executed.
|
||||||
|
boot.kernelParams = [ "ip=127.0.0.1:::::lo:none" ];
|
||||||
|
|
||||||
|
boot.initrd.network = {
|
||||||
|
enable = true;
|
||||||
|
ssh = {
|
||||||
|
enable = true;
|
||||||
|
port = 2222;
|
||||||
|
hostKeys = [
|
||||||
|
# not using sops here because we cannot reliable deploy this secret
|
||||||
|
#config.sops.secrets.initrd-ssh-key.path
|
||||||
|
"/var/lib/secrets/initrd_ssh_key"
|
||||||
|
];
|
||||||
|
authorizedKeys = config.users.users.root.openssh.authorizedKeys.keys;
|
||||||
|
};
|
||||||
|
postCommands = ''
|
||||||
|
ip link set dev eth0 up
|
||||||
|
|
||||||
|
ip addr add ${cfg.ipv4.address}/${cfg.ipv4.cidr} dev eth0
|
||||||
|
ip route add ${cfg.ipv4.gateway} dev eth0
|
||||||
|
ip route add default via ${cfg.ipv4.gateway} dev eth0
|
||||||
|
|
||||||
|
ip -6 addr add ${cfg.ipv6.address}/${cfg.ipv6.cidr} dev eth0
|
||||||
|
ip -6 route add default via fe80::1 dev eth0
|
||||||
|
'';
|
||||||
|
|
||||||
|
};
|
||||||
|
boot.initrd.kernelModules = [
|
||||||
|
"e1000e" # older hetzner machines, 1 GbE nics
|
||||||
|
"igc" # newer herzner machines, 2.5 GbE nics
|
||||||
|
# for debugging installation in vms
|
||||||
|
"virtio_pci"
|
||||||
|
"virtio_net"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
83
modules/xfs-lvm-crypto-raid.nix
Normal file
83
modules/xfs-lvm-crypto-raid.nix
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
{ self, lib, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
disk = index: {
|
||||||
|
type = "disk";
|
||||||
|
device = "/dev/nvme${toString index}n1";
|
||||||
|
content = {
|
||||||
|
type = "gpt";
|
||||||
|
partitions =
|
||||||
|
# systemd only wants to have one /boot partition
|
||||||
|
# should we rsync?
|
||||||
|
(lib.optionalAttrs (index == 0) {
|
||||||
|
boot = {
|
||||||
|
type = "EF00";
|
||||||
|
size = "1G";
|
||||||
|
content = {
|
||||||
|
type = "filesystem";
|
||||||
|
format = "vfat";
|
||||||
|
mountpoint = "/boot";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}) // {
|
||||||
|
root = {
|
||||||
|
size = "100%";
|
||||||
|
content = {
|
||||||
|
type = "luks";
|
||||||
|
name = "crypted${toString index}";
|
||||||
|
keyFile = "/tmp/secret.key";
|
||||||
|
content = {
|
||||||
|
type = "lvm_pv";
|
||||||
|
vg = "pool";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
self.inputs.disko.nixosModules.disko
|
||||||
|
];
|
||||||
|
|
||||||
|
boot.initrd.kernelModules = [
|
||||||
|
"xhci_pci"
|
||||||
|
"ahci"
|
||||||
|
"sd_mod"
|
||||||
|
"nvme"
|
||||||
|
"dm-raid"
|
||||||
|
"dm-integrity"
|
||||||
|
];
|
||||||
|
|
||||||
|
disko.devices = {
|
||||||
|
disk = {
|
||||||
|
nvme0n1 = disk 0;
|
||||||
|
nvme1n1 = disk 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
lvm_vg = {
|
||||||
|
pool = {
|
||||||
|
type = "lvm_vg";
|
||||||
|
lvs = {
|
||||||
|
root = {
|
||||||
|
size = "95%FREE";
|
||||||
|
lvm_type = "raid1";
|
||||||
|
extraArgs = [
|
||||||
|
"--raidintegrity"
|
||||||
|
"y"
|
||||||
|
];
|
||||||
|
content = {
|
||||||
|
type = "filesystem";
|
||||||
|
format = "xfs";
|
||||||
|
mountpoint = "/";
|
||||||
|
mountOptions = [
|
||||||
|
"defaults"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
@ -3,11 +3,8 @@ terraform {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# do we still need this module when leaving hcloud?
|
||||||
module "admin" {
|
module "admin" {
|
||||||
source = "../../terraform/admins"
|
source = "../../terraform/admins"
|
||||||
ssh_keys = {
|
ssh_keys = jsondecode(file("${path.module}/users.json"))
|
||||||
mic92 = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKbBp2dH2X3dcU1zh+xW3ZsdYROKpJd3n13ssOP092qE joerg@turingmachine"
|
|
||||||
lassulus = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDIb3uuMqE/xSJ7WL/XpJ6QOj4aSmh0Ga+GtmJl3CDvljGuIeGCKh7YAoqZAi051k5j6ZWowDrcWYHIOU+h0eZCesgCf+CvunlXeUz6XShVMjyZo87f2JPs2Hpb+u/ieLx4wGQvo/Zw89pOly/vqpaX9ZwyIR+U81IAVrHIhqmrTitp+2FwggtaY4FtD6WIyf1hPtrrDecX8iDhnHHuGhATr8etMLwdwQ2kIBx5BBgCoiuW7wXnLUBBVYeO3II957XP/yU82c+DjSVJtejODmRAM/3rk+B7pdF5ShRVVFyB6JJR+Qd1g8iSH+2QXLUy3NM2LN5u5p2oTjUOzoEPWZo7lykZzmIWd/5hjTW9YiHC+A8xsCxQqs87D9HK9hLA6udZ6CGkq4hG/6wFwNjSMnv30IcHZzx6IBihNGbrisrJhLxEiKWpMKYgeemhIirefXA6UxVfiwHg3gJ8BlEBsj0tl/HVARifR2y336YINEn8AsHGhwrPTBFOnBTmfA/VnP1NlWHzXCfVimP6YVvdoGCCnAwvFuJ+ZuxmZ3UzBb2TenZZOzwzV0sUzZk0D1CaSBFJUU3oZNOkDIM6z5lIZgzsyKwb38S8Vs3HYE+Dqpkfsl4yeU5ldc6DwrlVwuSIa4vVus4eWD3gDGFrx98yaqOx17pc4CC9KXk/2TjtJY5xmQ=="
|
|
||||||
dave = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDuhpzDHBPvn8nv8RH1MRomDOaXyP4GziQm7r3MZ1Syk"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -4,9 +4,9 @@ set -euo pipefail
|
|||||||
rm -f .terraform.lock.hcl
|
rm -f .terraform.lock.hcl
|
||||||
if grep -q .sops terraform.tfstate; then
|
if grep -q .sops terraform.tfstate; then
|
||||||
sops -i -d terraform.tfstate
|
sops -i -d terraform.tfstate
|
||||||
if [[ -f secrets.auto.tfvars.sops.json ]]; then
|
fi
|
||||||
|
if [[ -f secrets.auto.tfvars.sops.json ]]; then
|
||||||
sops -d secrets.auto.tfvars.sops.json > secrets.auto.tfvars.json
|
sops -d secrets.auto.tfvars.sops.json > secrets.auto.tfvars.json
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
cleanup() {
|
cleanup() {
|
||||||
rm -f secrets.auto.tfvars.json
|
rm -f secrets.auto.tfvars.json
|
||||||
|
5
targets/admins/users.json
Normal file
5
targets/admins/users.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"mic92": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKbBp2dH2X3dcU1zh+xW3ZsdYROKpJd3n13ssOP092qE joerg@turingmachine",
|
||||||
|
"lassulus": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDIb3uuMqE/xSJ7WL/XpJ6QOj4aSmh0Ga+GtmJl3CDvljGuIeGCKh7YAoqZAi051k5j6ZWowDrcWYHIOU+h0eZCesgCf+CvunlXeUz6XShVMjyZo87f2JPs2Hpb+u/ieLx4wGQvo/Zw89pOly/vqpaX9ZwyIR+U81IAVrHIhqmrTitp+2FwggtaY4FtD6WIyf1hPtrrDecX8iDhnHHuGhATr8etMLwdwQ2kIBx5BBgCoiuW7wXnLUBBVYeO3II957XP/yU82c+DjSVJtejODmRAM/3rk+B7pdF5ShRVVFyB6JJR+Qd1g8iSH+2QXLUy3NM2LN5u5p2oTjUOzoEPWZo7lykZzmIWd/5hjTW9YiHC+A8xsCxQqs87D9HK9hLA6udZ6CGkq4hG/6wFwNjSMnv30IcHZzx6IBihNGbrisrJhLxEiKWpMKYgeemhIirefXA6UxVfiwHg3gJ8BlEBsj0tl/HVARifR2y336YINEn8AsHGhwrPTBFOnBTmfA/VnP1NlWHzXCfVimP6YVvdoGCCnAwvFuJ+ZuxmZ3UzBb2TenZZOzwzV0sUzZk0D1CaSBFJUU3oZNOkDIM6z5lIZgzsyKwb38S8Vs3HYE+Dqpkfsl4yeU5ldc6DwrlVwuSIa4vVus4eWD3gDGFrx98yaqOx17pc4CC9KXk/2TjtJY5xmQ==",
|
||||||
|
"dave": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDuhpzDHBPvn8nv8RH1MRomDOaXyP4GziQm7r3MZ1Syk"
|
||||||
|
}
|
20
targets/web01-new/configuration.nix
Normal file
20
targets/web01-new/configuration.nix
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{ self, config, ... }:
|
||||||
|
let
|
||||||
|
admins = builtins.fromJSON (builtins.readFile ../admins/users.json);
|
||||||
|
in
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
self.nixosModules.web01
|
||||||
|
self.nixosModules.hetzner-ex101
|
||||||
|
];
|
||||||
|
networking.hostName = "web01";
|
||||||
|
systemd.network.networks."10-uplink".networkConfig.Address = "2a01:4f9:3080:282a::1";
|
||||||
|
sops.defaultSopsFile = ./secrets.yaml;
|
||||||
|
users.users.root.openssh.authorizedKeys.keys = builtins.attrValues admins;
|
||||||
|
|
||||||
|
clan.networking.ipv4.address = "65.109.103.5";
|
||||||
|
clan.networking.ipv4.gateway = "65.109.103.1";
|
||||||
|
clan.networking.ipv6.address = config.systemd.network.networks."10-uplink".networkConfig.Address;
|
||||||
|
|
||||||
|
system.stateVersion = "23.05";
|
||||||
|
}
|
23
targets/web01-new/decrypt.sh
Executable file
23
targets/web01-new/decrypt.sh
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
#!/usr/bin/env nix-shell
|
||||||
|
#!nix-shell -i bash -p coreutils sops openssh
|
||||||
|
|
||||||
|
set -euox pipefail
|
||||||
|
|
||||||
|
if [ $# -ne 1 ]; then
|
||||||
|
echo "Usage: $0 <host>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
HOST=$1
|
||||||
|
temp=$(mktemp -d)
|
||||||
|
trap 'rm -rf $temp' EXIT
|
||||||
|
sops --extract '["cryptsetup_key"]' -d secrets.yaml > "$temp/secret.key"
|
||||||
|
|
||||||
|
while ! ping -4 -W 1 -c 1 "$HOST"; do
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
while ! timeout 4 ssh -p 2222 "root@$HOST" true; do
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
|
ssh -p 2222 "root@$HOST" "cat > /crypt-ramfs/passphrase" < "$temp/secret.key"
|
1
targets/web01-new/nixos-vars.json
Normal file
1
targets/web01-new/nixos-vars.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"ipv6_address":"2a01:4f9:3080:282a::1"}
|
24
targets/web01-new/secrets.auto.tfvars.sops.json
Normal file
24
targets/web01-new/secrets.auto.tfvars.sops.json
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"hetznerdns_token": "ENC[AES256_GCM,data:QMMn/j2Lv0Mz/2PhaYQygBjxEoU6f6hL23D5DrderFo=,iv:lOeXBlx/Lb7adzK2SKDKELxXNjlDNWVWQtLp+Mn6YaI=,tag:zTBP/IFdum6T5zITk+WU9A==,type:str]",
|
||||||
|
"sops": {
|
||||||
|
"kms": null,
|
||||||
|
"gcp_kms": null,
|
||||||
|
"azure_kv": null,
|
||||||
|
"hc_vault": null,
|
||||||
|
"age": [
|
||||||
|
{
|
||||||
|
"recipient": "age17n64ahe3wesh8l8lj0zylf4nljdmqn28hvqns2g7hgm9mdkhlsvsjuvkxz",
|
||||||
|
"enc": "-----BEGIN AGE ENCRYPTED FILE-----\nYWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBTYlpjUjk4NzNuRXFLT1dS\nbW1EQXBVQ2NIUys3UVR0UE1mZGI4WVJpTVg4CkZqMlRZbS9vSFBpWXNrVXQ2MGVu\nNjhxMEx4dGZRcjBBdmFxcC9yaHN1ZlkKLS0tIHNSSUJVYUVaVU5ocmpZbVd0R2g3\nMnRzcTc5dXRTS1FvRGYwaWVKK29ZRnMKGRVM6m9Rela5ccZkxpEVtNkO/mC+D5kv\n6Yu8tR9BNY9EOyFGze/gNiQfam10vWZz/z9O0RCiE87TgVo7BUZk2g==\n-----END AGE ENCRYPTED FILE-----\n"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"recipient": "age1eq0e6uhjj2tja8v338tkdz8ema2aw5anpuyaq2uru7rt4lq7msyqqut6m2",
|
||||||
|
"enc": "-----BEGIN AGE ENCRYPTED FILE-----\nYWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSA4bVl2anFPYW1ud2I0bk1K\nU3h1WjcvcWwzUzhJbUdYbWpWMzZ1RUplcFFvClkvZVZrNXpUTjBhNVkrcFZLVldZ\ncitveEtOZCtRRWViRUp2TDBjYXlCMncKLS0tIFZqNE1HR3ArNG9sRDJrOEl1QW15\nVUxpVzFOakR1elo1Z0J1cmpkRVFQNlkKegq9LtnVoD88SKCP13taMAZGQ4uZU+eQ\nZQ//y4E5MZxcz6cl0x91khMqIgXsZ92Qs0gNreC69NB4yt8Gp42oYQ==\n-----END AGE ENCRYPTED FILE-----\n"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"lastmodified": "2023-07-13T15:46:42Z",
|
||||||
|
"mac": "ENC[AES256_GCM,data:TYlJZLdIvaWD96RQg5RnUJyNAR69bze0f0+Ai37BfA0G6VEWDZqvc537vRFk7dj4R8kYCe4q79w7yWmSt30UUZ+SXHSjVcUU9WijO4QprrUz/q4r9ezVZfQLe6disaUDdgsqhQvkQSh0AJ5eJtcr1uVChOViVfH/nk/FfJgUc7s=,iv:ulkInzkkD2ZG8uSQW3vrkAjVD1gWExtultU8zhs2+aU=,tag:bxNP152hKrLBh2zKeGM8KA==,type:str]",
|
||||||
|
"pgp": null,
|
||||||
|
"unencrypted_suffix": "_unencrypted",
|
||||||
|
"version": "3.7.3"
|
||||||
|
}
|
||||||
|
}
|
48
targets/web01-new/secrets.yaml
Normal file
48
targets/web01-new/secrets.yaml
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
cryptsetup_key: ENC[AES256_GCM,data:79qOTOi4ftTmIWuc/7bFf3NXaa2Fs6mTUfji,iv:xq9HM2uB4rr75qeZEAh2pFvEDAtXdFhsrT/manI7RqM=,tag:iELo+UHSplsQWIK9aQ+uMw==,type:str]
|
||||||
|
initrd_ssh_key: ENC[AES256_GCM,data:SpSX6RgnpgVkd3sL+mJx0Lk6RnagfxwO1cUKtbj4wxlJHpSsBnI6+tGJjssoCp38jHOPYZ4U0IE960ojjtXyBL/sF37Sw0E8uDGr0rL/wuuQmzhF3AC9VfuDOQNbe0pYTr7HldzIvbDRowIShxqbKfBVizkR1bxZkmHfDpMKE1gGivFLYeHC+gSVgTBtPEgDCx361+I103K2kCczu2VGnfmfc9ExrTO6/7ruj2DRjFLOaVmkXe896KjN+YpTTjT85gjEZJ75AGEUNKCNppQRkM0RpJBJyRunHmKqxh5VnFnlbiklsX2S5ev07G9oqIu0kZI6XduQjj/okB/4SeoY9QE6FOj6dRi2WSBNGpT9fBnV4i6bv2Z612ISXwO0GGfXQeWE4mA8QSaJ9oa/fnVFb7WolU9DISq8sYPc85VXVJGCFZ17DDVGK/capjveGErXnk6lJieBwArN5xEZfr/tPL15Q1DNdyYOJwiL1bODQwxYExpFu32XJ/ZMDiucWDXnEwJJf7WpThh0FiAZFzGAJ0b3SeJpuQvK6xXD,iv:w+YuoZMUswV9sw31PXFLKHbinRit9twPDqofeojVdZo=,tag:eCYSUX5EA/NTD3yIdTC7PA==,type:str]
|
||||||
|
ssh_host_ed25519_key: ENC[AES256_GCM,data:68nXUeyy7xh/KKdd4ajdrkuzc54ZpnXhMpPjaDYtwMLlHja/O/t7g4IlVgLTKWwgMbr5/lAj04cEI99dAuoARaE+p4ldQeQNzPb7ZOPyRmSnBgO/qgtZoKNLaIX7q+Mwl+vsa2d2ZSHG8Fu7hzNIELWHQoaIFi782U+yKt2LHhahdVyY/FUPcymi0EtrwCqBHKSlEu+SXiwDXT4f+PCBtyaCJT4T4Mo2+TbERur9r9YOnKG2GEg46lDwTrr6FMya5K2WBks7AQwQ+rpoHCEy05tTg3GTJd8DypLhemrHMD7HeYzRf+HnVCyTngxmoquCD5/g9OM+fu63GIsnbGItWxREfjfzvODKuPaVCOat4mWQr1pLch1lcIkxQhU4EXg4LgHUMXFnQFrR8rvRT++YK1nRLB3w/lyvU4PAoocYlNR3G9JEClRnu4GH615ILEjXhyUZyAHIGx1+W7M6j4aGFhm3NOJWCTctaFd5r6uUeTqDpV757UzgHIR5lhtlfjeL41r3mmN09os/HpKt9EZ0,iv:+T4xz2xvyerO/ffW/YAKUkf5B/UVL8cUOl/ifWKIIx4=,tag:NTJklV5yqMT7uq0TvclhIA==,type:str]
|
||||||
|
ssh_host_ed25519_key.pub: ENC[AES256_GCM,data:k5T5CX56wSm1DADOH47sGb1h65aPk3NSvQR6Rgu7ZzRrq4pF84ofaRMEJU5d9MHnb+Eg92jnibRNwK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+23jbX1m/JElsj4ig/vnUOhZnI5FNvGjfavnTvVeKaXVAjnWk04rxF2zsxm5H91xSh6qUWe1fFBdgzG2KW4d69Kmi3I9zPo9p6GwqkKEHJdXd6KmLbSoPmfP22Gv6vYbFWl5NKKfPiimw+IXLAGyzz8gWHk7cLA4J9vGSiaxbdLkvbAbvdZJ9K97LmyYsFVzAuz75UbLqyGZysn18OceoSo3nTEiy/WCIjfXsKu95/lYOd6fycfDF+gpkp8ejw3C0JRiZ939CFpG/MrUpCQrgzz9xgKpcTy5w0yWt30naZGlVZ0kcAjv/Bd2X0ON/eEdBrq/MnJHaMDOuuVe9iA+lNVqhFMqEsemOUSJm7R1Ttug4PFdiaMYUg==,iv:9DD76j3rDz+KFw6BmC4mVfhfgadjCR1DXytfV6dKeHY=,tag:Z7Akx72UnALXIcdUIrYWpw==,type:str]
|
||||||
|
harmonia-key: ENC[AES256_GCM,data:pZObqfbLogp0DYs47Tg2STKT9HptPSiP4sgcf31FD68PKSWhkgJbdY3gO/pfa0zsnvZTrAiljR8Ugh/x9z70T/XhjgZ/dIKqtcrGw0or9WPDmVzD4UHYm6iWR30MZLa9EBK0GFInlcSa/g==,iv:9HRnOaqP1iKMyyRX7evl6woZgfw9h4t7mBD98v/iBng=,tag:MQDio//aEOAOTVWlgADYDQ==,type:str]
|
||||||
|
matrix-server-key: ENC[AES256_GCM,data:0148ezOFk8jX5KPQPCG0jQK9ajSfe/iOdUqlvys5/M8DrIwPXH9GzrkknwH+l8kF9ViTRDC/q5md8J2bj3/FBR/RW4rwjDrYx9cBEFm8wjHrywUlwON8kNKtj9ycJmXgtRyCrVGv7sBmODy0ZC5ZfWbhIQh6xWBkX2/rsSh4zwi/1PoHLpOO3u4=,iv:IwHPDi1E3R9LAY/seGpvx1U+N8mB9NMrUjLg4KMA1UA=,tag:pwRJ/CqkFN2eedrnMAaj2w==,type:str]
|
||||||
|
registration-secret: ENC[AES256_GCM,data:EvPearZAxxb2irZFYgvy/tFA72h+IABuzwCbvy94IYR0eoHjuYw6GBde8CNUWG4SUiwyXJr4v438o/YThDhehsZ/cZFjg2o=,iv:ogN4/Iia5Zl95a3HP1KZoy86K8LyBFYw50cZUpkDNQo=,tag:5wU2OrNi7b5gWPfFZcGLjg==,type:str]
|
||||||
|
gitea-actions-runner: ENC[AES256_GCM,data:JKXAa7J1V3GH8lp3UtHTBmiezJlqxX1ItHLE7UcaIeNFQH8We2imaOMVftMpVCeXTpRX,iv:W9+4wH4asw3+w28i5om0OcJFHrABC85bhjhbgGWEs8E=,tag:Rf9XBeiEoJ1Pt8Z1TDIyJA==,type:str]
|
||||||
|
sops:
|
||||||
|
kms: []
|
||||||
|
gcp_kms: []
|
||||||
|
azure_kv: []
|
||||||
|
hc_vault: []
|
||||||
|
age:
|
||||||
|
- recipient: age17n64ahe3wesh8l8lj0zylf4nljdmqn28hvqns2g7hgm9mdkhlsvsjuvkxz
|
||||||
|
enc: |
|
||||||
|
-----BEGIN AGE ENCRYPTED FILE-----
|
||||||
|
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBrVTJrY2hIdis5eGJYQkdM
|
||||||
|
MUdGTmVkc2pxN1NjbkR2NVF6Uk11SnBSSUNrCnY0dXlTMnpTbnNJdjNJZHZtYWE4
|
||||||
|
YmlUWFpkUXdtbFh6R1BvTjd1UEZTRFUKLS0tIEdTMEozMFltVWJ0Q1BZS201eE50
|
||||||
|
UHcwNW5nNkdHL0w2d3g0RzBQZ1RrY3MKCDNdsobZ7wZOjBWOy0FmBR0i0afpHM/x
|
||||||
|
uDax1cdEXnh710TTI0Ck99KGthFRWBIeJH1xioC6TTsgmrgE4VPkNA==
|
||||||
|
-----END AGE ENCRYPTED FILE-----
|
||||||
|
- recipient: age1eq0e6uhjj2tja8v338tkdz8ema2aw5anpuyaq2uru7rt4lq7msyqqut6m2
|
||||||
|
enc: |
|
||||||
|
-----BEGIN AGE ENCRYPTED FILE-----
|
||||||
|
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBwRWp6R3B2T3N0aE1GaU8r
|
||||||
|
cUppT0ZrNGJTTXhsZi9EU3dRZTNTR09tYVdvCmVBUFRVWkFTeHZVMDFhSDNQY1dL
|
||||||
|
T09zMjN4ZkZpNFRqZjVqWVRZOGdIaGcKLS0tIGNJbnBFNDAvMS9pdndVRklTNHZ2
|
||||||
|
UjRPRXB5RkxYUDN2TVE2ZTlzV0I5NGsK8tIxBNl0UFkAw1u8Jn7QjnDJ6dcr4+6P
|
||||||
|
iHXTDyxadZAljV5ZXlmzM1dm5p+v86jJ/KvYbA0dkga+CBEOUDt3Yw==
|
||||||
|
-----END AGE ENCRYPTED FILE-----
|
||||||
|
- recipient: age17xuvz0fqtynzdmf8rfh4g3e46tx8w3mc6zgytrmuj5v9dhnldgxs7ue7ct
|
||||||
|
enc: |
|
||||||
|
-----BEGIN AGE ENCRYPTED FILE-----
|
||||||
|
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBZRDh2OWxJdjcwK0o1M3Nt
|
||||||
|
RXV4UTlnbFphR0JISG9ZcGorb1ppMzd4SVR3CnZTOW9YeHBKR3drTHdGb3pEZVI3
|
||||||
|
S3NtbDFHL2dlZlRKK3FIc0lwMGt1SzQKLS0tIEZrMWNLOEtuTXB5eE93Uy9nalhD
|
||||||
|
Q2J3VHNZZm13RlFwekJ6MHpPTmpZek0KiOqGozDqC5QQop5y+Scq+QHhVSXX43Ix
|
||||||
|
KS496VWzRCdXYdgMk9gleA0AjaOGdAZOzdxsMQrWo+XfHrCy/1fU/w==
|
||||||
|
-----END AGE ENCRYPTED FILE-----
|
||||||
|
lastmodified: "2023-07-18T12:55:47Z"
|
||||||
|
mac: ENC[AES256_GCM,data:suFEE3xr2EZtidjH2Qpp1TvcYIn7dBorWcRUqef82TCf0o8/zQmd02g4eqSXKSl+SQ8/cUm72EuEVqZtvzo+pqw6cJht1pkeRMHJGPMjlz7MelUZwQpb0PoUy5he6neA9BfLi455DTuFIpi7fQi/c9E0B9IfR3ocsDdOQzf8Le0=,iv:wh8MeQbQ/Azf1eSQk/XWT3vv0KNh+QBL++ob5aKZaC0=,tag:U/lQvBtvuZKqgm5bVdqAxQ==,type:str]
|
||||||
|
pgp: []
|
||||||
|
unencrypted_suffix: _unencrypted
|
||||||
|
version: 3.7.3
|
21
targets/web01-new/terraform.tf
Normal file
21
targets/web01-new/terraform.tf
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
terraform {
|
||||||
|
backend "local" {}
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "hetznerdns_token" {}
|
||||||
|
|
||||||
|
module "web01" {
|
||||||
|
source = "../../terraform/web01-new"
|
||||||
|
hostname = "new.clan.lol"
|
||||||
|
dns_zone = "new.clan.lol"
|
||||||
|
nixos_flake_attr = ".#web01-new"
|
||||||
|
nixos_vars_file = "${path.module}/nixos-vars.json"
|
||||||
|
hetznerdns_token = var.hetznerdns_token
|
||||||
|
ipv4_address = "65.109.103.5"
|
||||||
|
ipv6_address = "2a01:4f9:3080:282a::1"
|
||||||
|
sops_secrets_file = "${abspath(path.module)}/secrets.yaml"
|
||||||
|
tags = {
|
||||||
|
Terraform = "true"
|
||||||
|
Target = "web01-new"
|
||||||
|
}
|
||||||
|
}
|
28
targets/web01-new/terraform.tfstate
Normal file
28
targets/web01-new/terraform.tfstate
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
"data": "ENC[AES256_GCM,data:caaRZCrdJGMdmmMY+9uaCh7ic+K45o4h3rtIPgScELj9HHyntHQHjQeOClyHsJraQywJE1pavrY0ngSN/81QPV+4qjrJ48r5wx2H2M80Al3rhCi/E7Puw+ueODdDIwxixAscaORO/SUF1NAJEqy6pK3CiR1qSXkzqrpx2UMyMO1cmeqYlWZ0b5A/Sk06yV+6aJ8Fto95cCpG+ByxSDi/dvQjC0JF/Ls3mk2NaBi4q10W0aH2UJKlwBt8dvnUB0eo8GPFGvfUMdRzOS6ZH3pT2NNgYJ0qlKwE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e6RUfm/F/tjkPlz1pIIOTXBaGrCWuWEFkRrCAf5UgbfTNSnSbxnoW8+fEqFG+14urF5yo0SM9Jy7rkLlTQU0HRUuliZ3a/vnF6hERYP7EiRpdVL41nz5V8vRmD1ZuPnhxFAQxko89mcMvJcof2V0sAV3jkS0OgUb5kVuL8Rl9rTqsL4L0Oh37du4tW0+T0Iq4vk6ZlZqPH8TR+iqMiuUYN09jrS,iv:zCxJDmdLPlVOzuXXqgszYIQ17A5rsJkyTi03SzhKWao=,tag:QzqemDqiHKsx6sHPZuSCYA==,type:str]",
|
||||||
|
"sops": {
|
||||||
|
"kms": null,
|
||||||
|
"gcp_kms": null,
|
||||||
|
"azure_kv": null,
|
||||||
|
"hc_vault": null,
|
||||||
|
"age": [
|
||||||
|
{
|
||||||
|
"recipient": "age17n64ahe3wesh8l8lj0zylf4nljdmqn28hvqns2g7hgm9mdkhlsvsjuvkxz",
|
||||||
|
"enc": "-----BEGIN AGE ENCRYPTED FILE-----\nYWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSAwYXFrSHZLU3BidTAyb0ky\nK21KQkdIZk1LWk9JM2hwVE5iMmR4QnEzRW0wCjdVeVl3VGFZM2hDZkpoZjBQaWhn\nWUdPTWgybVd0OFhyMkhocmlFTVYzOXcKLS0tIFRUN1BPQ1FxcUtlL1NXcTR1VFdM\nSWU2VGtiZEIzN09iSU9aalN0cWREd0kKW/YZLXvITLBxM5RwEvKMbzgfk2pXmQ0j\ng+o6u+Ga1PdlE8PhFuhCjbgVmkIZARB5AuBXGzRlu0wqUwpErTg9wQ==\n-----END AGE ENCRYPTED FILE-----\n"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"recipient": "age1eq0e6uhjj2tja8v338tkdz8ema2aw5anpuyaq2uru7rt4lq7msyqqut6m2",
|
||||||
|
"enc": "-----BEGIN AGE ENCRYPTED FILE-----\nYWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBCcjFkcWFqaWRBTVRSaGsr\nMWxTa2V2T2paNXhrNHc1bHFUQytja3I2aGpJCkYyRTVPTTFTSnBtNEh1Y3pWWXFO\ndEZBMnBIN2hVMU9vQlovQi82UENlUU0KLS0tIEZCSFN2QlEzaVZBNGpoa2xDM3Vm\ndnQ0V1BXaTRwZzV0Vm4yNXVWYU0ySlUK6R+9lTWUUk81dhhffVZ6CUxCUpsigZj9\n3sHLtXGz8Y1jjqHRyInYRl2nJa6YNATOAfDgmewpqlfjzR/4X6Haow==\n-----END AGE ENCRYPTED FILE-----\n"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"recipient": "age1vphy2sr6uw4ptsua3gh9khrm2cqyt65t46tusmt44z98qa7q6ymq6prrdl",
|
||||||
|
"enc": "-----BEGIN AGE ENCRYPTED FILE-----\nYWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBsSldvZnZJZUR1NXJwcjgz\nS2M2M0hlc3JFbUZQODZLS09ycTlUS2tRMlYwCkdGczA1WUtYYmQ5Z1JJWExGYU1N\nV2F6bE9CNmZUL1d2Y1E4czZuRG44RTQKLS0tIFhKZW0rWXpKWGRDVGNUSUw2RktG\nSDFKdm9kTVBJQWhhTnhrVGZmUk5wb3cK3rRG2lgJ8NaEcHzqTkSjJAhXVha0p8Wz\n7KWo+uMEyuHmN2UqDv3HVSIxa/3Xt8hddzeNm1CuVtl+6qC6obg3RA==\n-----END AGE ENCRYPTED FILE-----\n"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"lastmodified": "2023-07-18T14:10:51Z",
|
||||||
|
"mac": "ENC[AES256_GCM,data:nPkXwnKUCSMmkWQpIb3gg08NN2ARLqJi03HzFxLY2ArL8BnXn5OpaJrEND15IIQ0vGokNOSvZESgQphRSk4x1nspGi/9JZ0Km4R0YwzN1wUNIreVcIYNP5JsBshT74g4fi6xNrrU3UWd07p8H9vjzV/djz7oNqDGIZ+Uqmqrrlk=,iv:R/BDTLiMDA+gFSNCDkHYBHQPxQddUoiQwa1y+QGnTMk=,tag:9KvcbdRIkXFHAw/x8WYnIA==,type:str]",
|
||||||
|
"pgp": null,
|
||||||
|
"unencrypted_suffix": "_unencrypted",
|
||||||
|
"version": "3.7.3"
|
||||||
|
}
|
||||||
|
}
|
1
targets/web01-new/tf.sh
Symbolic link
1
targets/web01-new/tf.sh
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../admins/tf.sh
|
76
terraform/web01-new/dns.tf
Normal file
76
terraform/web01-new/dns.tf
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
locals {
|
||||||
|
subhostnames = [
|
||||||
|
"@",
|
||||||
|
"git",
|
||||||
|
"mail",
|
||||||
|
"cache",
|
||||||
|
"matrix",
|
||||||
|
"www"
|
||||||
|
]
|
||||||
|
hostnames = [
|
||||||
|
var.hostname,
|
||||||
|
"www.${var.hostname}",
|
||||||
|
"git.${var.hostname}",
|
||||||
|
"mail.${var.hostname}",
|
||||||
|
"cache.${var.hostname}",
|
||||||
|
"matrix.${var.hostname}",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "hetznerdns_zone" "server" {
|
||||||
|
name = var.dns_zone
|
||||||
|
ttl = 3600
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "hetznerdns_record" "server_a" {
|
||||||
|
for_each = toset(local.subhostnames)
|
||||||
|
zone_id = hetznerdns_zone.server.id
|
||||||
|
name = each.value
|
||||||
|
type = "A"
|
||||||
|
value = var.ipv4_address
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "hetznerdns_record" "server_aaaa" {
|
||||||
|
for_each = toset(local.subhostnames)
|
||||||
|
zone_id = hetznerdns_zone.server.id
|
||||||
|
name = each.value
|
||||||
|
type = "AAAA"
|
||||||
|
value = var.ipv6_address
|
||||||
|
}
|
||||||
|
|
||||||
|
# for sending emails
|
||||||
|
resource "hetznerdns_record" "spf" {
|
||||||
|
zone_id = hetznerdns_zone.server.id
|
||||||
|
name = "@"
|
||||||
|
type = "TXT"
|
||||||
|
value = "\"v=spf1 ip4:${var.ipv4_address} ip6:${var.ipv6_address} ~all\""
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "hetznerdns_record" "dkim" {
|
||||||
|
zone_id = hetznerdns_zone.server.id
|
||||||
|
name = "v1._hostnamekey"
|
||||||
|
type = "TXT"
|
||||||
|
# take from `systemctl status opendkim`
|
||||||
|
value = "\"v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDTFSkQcM0v6mC4kiWEoF/EgK/hPVgOBJlHesLVIe+8BmidylaUowKlyC2gECipXhoVX9++OfMFAKNtGrIJcCTVNH/DRGkhbHLSxzzXijCbJ7G/fjpHRifpxMydEmybQDKdidR44YMR74Aj0OwUEgu+N/yJZ2+ubOlstW0fZJaJwQIDAQAB\""
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "hetznerdns_record" "adsp" {
|
||||||
|
zone_id = hetznerdns_zone.server.id
|
||||||
|
name = "_adsp._hostnamekey"
|
||||||
|
type = "TXT"
|
||||||
|
value = "\"dkim=all;\""
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "hetznerdns_record" "matrix" {
|
||||||
|
zone_id = hetznerdns_zone.server.id
|
||||||
|
name = "_matrix._tcp"
|
||||||
|
type = "SRV"
|
||||||
|
value = "0 5 443 matrix"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "hetznerdns_record" "dmarc" {
|
||||||
|
zone_id = hetznerdns_zone.server.id
|
||||||
|
name = "_dmarc"
|
||||||
|
type = "TXT"
|
||||||
|
value = "\"v=DMARC1; p=none; adkim=r; aspf=r; rua=mailto:joerc.dmarc@thalheim.io; ruf=mailto:joerg.dmarc@thalheim.io; pct=100\""
|
||||||
|
}
|
44
terraform/web01-new/install.sh
Normal file
44
terraform/web01-new/install.sh
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
#!/usr/bin/env nix-shell
|
||||||
|
#!nix-shell -i bash -p coreutils sops openssh nix
|
||||||
|
set -euox pipefail
|
||||||
|
|
||||||
|
if [[ -z "${HOST:-}" ]]; then
|
||||||
|
echo "HOST is not set"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [[ -z "${FLAKE_ATTR:-}" ]]; then
|
||||||
|
echo "FLAKE_ATTR is not set"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [[ -z "${SOPS_SECRETS_FILE:-}" ]]; then
|
||||||
|
echo "SOPS_SECRETS_FILE is not set"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
tmp=$(mktemp -d)
|
||||||
|
trap 'rm -rf $tmp' EXIT
|
||||||
|
|
||||||
|
|
||||||
|
mkdir -p "$tmp/etc/ssh" "$tmp/var/lib/secrets"
|
||||||
|
for keyname in ssh_host_rsa_key ssh_host_rsa_key.pub ssh_host_ed25519_key ssh_host_ed25519_key.pub; do
|
||||||
|
if [[ "$keyname" == *.pub ]]; then
|
||||||
|
umask 0133
|
||||||
|
else
|
||||||
|
umask 0177
|
||||||
|
fi
|
||||||
|
sops --extract '["'$keyname'"]' -d "$SOPS_SECRETS_FILE" > "$tmp/etc/ssh/$keyname"
|
||||||
|
done
|
||||||
|
|
||||||
|
umask 0177
|
||||||
|
sops --extract '["initrd_ssh_key"]' -d "$SOPS_SECRETS_FILE" > "$tmp/var/lib/secrets/initrd_ssh_key"
|
||||||
|
# restore umask
|
||||||
|
umask 0022
|
||||||
|
|
||||||
|
ssh "root@$HOST" "modprobe dm-raid && modprobe dm-integrity"
|
||||||
|
|
||||||
|
nix run --refresh github:numtide/nixos-anywhere -- \
|
||||||
|
--debug \
|
||||||
|
--disk-encryption-keys /tmp/secret.key <(sops --extract '["cryptsetup_key"]' --decrypt "$SOPS_SECRETS_FILE") \
|
||||||
|
--extra-files "$tmp" \
|
||||||
|
--flake "$FLAKE_ATTR" \
|
||||||
|
"root@$HOST"
|
32
terraform/web01-new/main.tf
Normal file
32
terraform/web01-new/main.tf
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
locals {
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "null_resource" "nixos-anywhere" {
|
||||||
|
triggers = {
|
||||||
|
instance_id = var.ipv4_address
|
||||||
|
}
|
||||||
|
connection {
|
||||||
|
type = "ssh"
|
||||||
|
user = "root"
|
||||||
|
host = var.ipv4_address
|
||||||
|
}
|
||||||
|
provisioner "remote-exec" {
|
||||||
|
# needed because kexec is broken
|
||||||
|
# https://github.com/numtide/nixos-anywhere/issues/136
|
||||||
|
script = "${path.module}/nixosify.sh"
|
||||||
|
}
|
||||||
|
provisioner "local-exec" {
|
||||||
|
environment = {
|
||||||
|
HOST = var.ipv4_address
|
||||||
|
FLAKE_ATTR = var.nixos_flake_attr
|
||||||
|
SOPS_SECRETS_FILE = var.sops_secrets_file
|
||||||
|
}
|
||||||
|
command = "bash -x ${path.module}/install.sh"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
locals {
|
||||||
|
nixos_vars = {
|
||||||
|
ipv6_address = var.ipv6_address
|
||||||
|
}
|
||||||
|
}
|
18
terraform/web01-new/nixos_vars.tf
Normal file
18
terraform/web01-new/nixos_vars.tf
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
resource "local_file" "nixos_vars" {
|
||||||
|
content = jsonencode(local.nixos_vars)
|
||||||
|
filename = var.nixos_vars_file
|
||||||
|
file_permission = "600"
|
||||||
|
|
||||||
|
provisioner "local-exec" {
|
||||||
|
interpreter = ["bash", "-c"]
|
||||||
|
command = "git add -f '${local_file.nixos_vars.filename}'"
|
||||||
|
}
|
||||||
|
# also pro-actively add hosts and flake-module.nix to git so nix can find it.
|
||||||
|
provisioner "local-exec" {
|
||||||
|
interpreter = ["bash", "-c"]
|
||||||
|
command = <<EOT
|
||||||
|
git add "$(dirname '${local_file.nixos_vars.filename}')"/{hosts,flake-module.nix}
|
||||||
|
EOT
|
||||||
|
on_failure = continue
|
||||||
|
}
|
||||||
|
}
|
76
terraform/web01-new/nixosify.sh
Normal file
76
terraform/web01-new/nixosify.sh
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
installNix() {
|
||||||
|
if ! command -v nix >/dev/null; then
|
||||||
|
echo "Installing Nix..."
|
||||||
|
trap 'rm -f /tmp/nix-install' EXIT
|
||||||
|
if command -v curl; then
|
||||||
|
curl -L https://nixos.org/nix/install >/tmp/nix-install
|
||||||
|
elif command -v wget; then
|
||||||
|
wget -O /tmp/nix-install https://nixos.org/nix/install
|
||||||
|
else
|
||||||
|
echo "Please install curl or wget"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
sh /tmp/nix-install --daemon --yes
|
||||||
|
fi
|
||||||
|
set +u
|
||||||
|
. /etc/profile
|
||||||
|
set -u
|
||||||
|
}
|
||||||
|
|
||||||
|
patchOsRelease() {
|
||||||
|
cat >/etc/os-release <<EOF
|
||||||
|
ID=nixos
|
||||||
|
VARIANT_ID=installer
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
installTools() {
|
||||||
|
env=$(
|
||||||
|
cat <<EOF
|
||||||
|
with import <nixpkgs> {};
|
||||||
|
buildEnv {
|
||||||
|
name = "install-tools";
|
||||||
|
paths = [
|
||||||
|
nix
|
||||||
|
nixos-install-tools
|
||||||
|
parted
|
||||||
|
mdadm
|
||||||
|
xfsprogs
|
||||||
|
dosfstools
|
||||||
|
btrfs-progs
|
||||||
|
e2fsprogs
|
||||||
|
jq
|
||||||
|
util-linux
|
||||||
|
];
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
)
|
||||||
|
tools=$(nix-build --no-out-link -E "$env")
|
||||||
|
|
||||||
|
# check if /usr/local/bin is in PATH
|
||||||
|
if ! echo "$PATH" | grep -q /usr/local/bin; then
|
||||||
|
echo "WARNING: /usr/local/bin is not in PATH" >&2
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p /usr/local/bin
|
||||||
|
for i in "$tools/bin/"*; do
|
||||||
|
ln -sf "$i" /usr/local/bin
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
applyHetznerZfsQuirk() {
|
||||||
|
if test -f /etc/hetzner-build; then
|
||||||
|
# Hetzner has dummy binaries here for zfs,
|
||||||
|
# however those won't work and even crashed the system.
|
||||||
|
rm -f /usr/local/sbin/zfs /usr/local/sbin/zpool /usr/local/sbin/zdb
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
installNix
|
||||||
|
patchOsRelease
|
||||||
|
installTools
|
||||||
|
applyHetznerZfsQuirk
|
12
terraform/web01-new/providers.tf
Normal file
12
terraform/web01-new/providers.tf
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
terraform {
|
||||||
|
required_providers {
|
||||||
|
hcloud = { source = "hetznercloud/hcloud" }
|
||||||
|
local = { source = "hashicorp/local" }
|
||||||
|
hetznerdns = { source = "timohirt/hetznerdns" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "hetznerdns_token" {}
|
||||||
|
provider "hetznerdns" {
|
||||||
|
apitoken = var.hetznerdns_token
|
||||||
|
}
|
40
terraform/web01-new/variables.tf
Normal file
40
terraform/web01-new/variables.tf
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
variable "ipv4_address" {
|
||||||
|
type = string
|
||||||
|
description = "IPv4 address of the machine"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "ipv6_address" {
|
||||||
|
type = string
|
||||||
|
description = "IPv6 address of the machine"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "nixos_vars_file" {
|
||||||
|
type = string
|
||||||
|
description = "File to write NixOS configuration variables to"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "nixos_flake_attr" {
|
||||||
|
type = string
|
||||||
|
description = "NixOS configuration flake attribute"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "sops_secrets_file" {
|
||||||
|
type = string
|
||||||
|
description = "Path to SOPS secrets file storing the secrets for ssh keys and cryptsetup keys"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "hostname" {
|
||||||
|
type = string
|
||||||
|
description = "Zone name of the machine"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "dns_zone" {
|
||||||
|
type = string
|
||||||
|
description = "DNS zone to add the machine to"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "tags" {
|
||||||
|
type = map(string)
|
||||||
|
default = {}
|
||||||
|
description = "Tags to add to the server"
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user