mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 12:29:19 -08:00
feat(katbox): add machine
This commit is contained in:
parent
5c73439cad
commit
0baa66c520
4 changed files with 110 additions and 0 deletions
7
systems/katbox/default.nix
Normal file
7
systems/katbox/default.nix
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
_: {
|
||||||
|
arch = "x86_64";
|
||||||
|
type = "NixOS";
|
||||||
|
modules = [
|
||||||
|
./nixos.nix
|
||||||
|
];
|
||||||
|
}
|
||||||
7
systems/katbox/lxc.json
Normal file
7
systems/katbox/lxc.json
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"lxc": {
|
||||||
|
"lxc.mount.entry": [
|
||||||
|
"/dev/net/tun dev/net/tun none bind,optional,create=file"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
26
systems/katbox/nixos.nix
Normal file
26
systems/katbox/nixos.nix
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
{
|
||||||
|
meta,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
imports = let
|
||||||
|
inherit (meta) nixos;
|
||||||
|
in [
|
||||||
|
#nixos.sops
|
||||||
|
nixos.base
|
||||||
|
nixos.reisen-ct
|
||||||
|
nixos.tailscale
|
||||||
|
];
|
||||||
|
|
||||||
|
#sops.defaultSopsFile = ./secrets.yaml;
|
||||||
|
|
||||||
|
systemd.network.networks.eth0 = {
|
||||||
|
name = "eth0";
|
||||||
|
matchConfig = {
|
||||||
|
MACAddress = "BC:24:11:34:F4:AB";
|
||||||
|
Type = "ether";
|
||||||
|
};
|
||||||
|
DHCP = "yes";
|
||||||
|
};
|
||||||
|
|
||||||
|
system.stateVersion = "23.11";
|
||||||
|
}
|
||||||
|
|
@ -4,6 +4,8 @@ variable "proxmox_container_template" {
|
||||||
}
|
}
|
||||||
|
|
||||||
locals {
|
locals {
|
||||||
|
proxmox_katbox_vm_id = 106
|
||||||
|
proxmox_katbox_config = jsondecode(file("${path.root}/../systems/aya/lxc.json"))
|
||||||
proxmox_aya_vm_id = 105
|
proxmox_aya_vm_id = 105
|
||||||
proxmox_aya_config = jsondecode(file("${path.root}/../systems/aya/lxc.json"))
|
proxmox_aya_config = jsondecode(file("${path.root}/../systems/aya/lxc.json"))
|
||||||
proxmox_reimu_vm_id = 104
|
proxmox_reimu_vm_id = 104
|
||||||
|
|
@ -381,3 +383,71 @@ EOT
|
||||||
ignore_changes = [started, description, operating_system[0], cdrom[0].enabled, cdrom[0].file_id]
|
ignore_changes = [started, description, operating_system[0], cdrom[0].enabled, cdrom[0].file_id]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resource "proxmox_virtual_environment_container" "katbox" {
|
||||||
|
node_name = "reisen"
|
||||||
|
vm_id = local.proxmox_katbox_vm_id
|
||||||
|
tags = ["tf"]
|
||||||
|
description = <<EOT
|
||||||
|
kat's box
|
||||||
|
EOT
|
||||||
|
|
||||||
|
memory {
|
||||||
|
dedicated = 512
|
||||||
|
swap = 512
|
||||||
|
}
|
||||||
|
|
||||||
|
disk {
|
||||||
|
datastore_id = "local-zfs"
|
||||||
|
size = 64
|
||||||
|
}
|
||||||
|
|
||||||
|
initialization {
|
||||||
|
hostname = "katbox"
|
||||||
|
ip_config {
|
||||||
|
ipv6 {
|
||||||
|
address = "auto"
|
||||||
|
}
|
||||||
|
ipv4 {
|
||||||
|
address = "auto"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
startup {
|
||||||
|
order = 4
|
||||||
|
up_delay = 0
|
||||||
|
down_delay = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
network_interface {
|
||||||
|
name = "eth0"
|
||||||
|
mac_address = "BC:24:11:C4:66:AB"
|
||||||
|
}
|
||||||
|
|
||||||
|
operating_system {
|
||||||
|
template_file_id = var.proxmox_container_template
|
||||||
|
type = "nixos"
|
||||||
|
}
|
||||||
|
|
||||||
|
unprivileged = true
|
||||||
|
features {
|
||||||
|
nesting = true
|
||||||
|
}
|
||||||
|
|
||||||
|
console {
|
||||||
|
type = "console"
|
||||||
|
}
|
||||||
|
started = false
|
||||||
|
|
||||||
|
lifecycle {
|
||||||
|
ignore_changes = [started, unprivileged, initialization[0].dns, operating_system[0].template_file_id]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module "katbox_config" {
|
||||||
|
source = "./system/proxmox/lxc/config"
|
||||||
|
connection = local.proxmox_reisen_connection
|
||||||
|
container = proxmox_virtual_environment_container.katbox
|
||||||
|
config = local.proxmox_katbox_config.lxc
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue