feat: tfvars, efi and pushing to code.tjo.space

This commit is contained in:
Tine 2024-08-22 18:16:39 +02:00
parent 797416e0fc
commit 19678552e6
Signed by: mentos1386
SSH key fingerprint: SHA256:MNtTsLbihYaWF8j1fkOHfkKNlnN1JQfxEU/rBU8nCGw
4 changed files with 36 additions and 5 deletions

4
.gitignore vendored
View file

@ -14,8 +14,8 @@ crash.*.log
# password, private keys, and other secrets. These should not be part of version # password, private keys, and other secrets. These should not be part of version
# control as they are data points which are potentially sensitive and subject # control as they are data points which are potentially sensitive and subject
# to change depending on the environment. # to change depending on the environment.
*.tfvars #*.tfvars
*.tfvars.json #*.tfvars.json
# Ignore override files as they are usually used to override resources locally and so # Ignore override files as they are usually used to override resources locally and so
# are not checked in # are not checked in

View file

@ -15,11 +15,23 @@ lint:
build: build:
@nix build .#vm @nix build .#vm
push:
#!/usr/bin/env sh
export NIXOS_IMAGE=$(nix path-info --quiet .#vm)/nixos.qcow2
export VERSION=$(echo $NIXOS_IMAGE | cut -d'/' -f4 | cut -d'-' -f1)
echo "Uploading $NIXOS_IMAGE to code.tjo.space"
echo "Version: $VERSION"
curl --user $CODE_TJO_SPACE_USER:$CODE_TJO_SPACE_TOKEN \
--progress-bar \
--upload-file $NIXOS_IMAGE \
https://code.tjo.space/api/packages/tjo-cloud/generic/ingress/${VERSION}/nixos.qcow2
deploy: deploy:
#!/usr/bin/env sh #!/usr/bin/env sh
export NIX_RESULT_DIR=$(nix build --print-out-paths .#vm) export NIXOS_IMAGE=$(nix path-info --quiet .#vm)/nixos.qcow2
export IMAGE_NAME=$(ls ${NIX_RESULT_DIR} | grep ".qcow2") export TF_VAR_image_path=$NIXOS_IMAGE
export TF_VAR_image_path=${NIX_RESULT_DIR}/${IMAGE_NAME}
cd {{justfile_directory()}}/terraform cd {{justfile_directory()}}/terraform
tofu init tofu init

View file

@ -89,6 +89,9 @@ resource "proxmox_virtual_environment_vm" "nodes" {
} }
bios = "ovmf" bios = "ovmf"
efi_disk {
datastore_id = each.value.storage
}
operating_system { operating_system {
type = "l26" type = "l26"

View file

@ -0,0 +1,16 @@
nodes = {
de_01 = {
name = "de-01"
host = "hetzner"
bridge = "vmprivate0"
cloudinit = ""
}
de_02 = {
name = "de-02"
host = "hetzner"
bridge = "vmprivate0"
cloudinit = ""
}
}
common_storage = "proxmox-backup-tjo-cloud"