feat: add omada lxc container

This commit is contained in:
Matthew McKinnon 2024-11-16 16:13:11 +10:00
parent 2e51bb1a18
commit 7b01bef6ad
3 changed files with 45 additions and 12 deletions

37
omada.tf Normal file
View File

@ -0,0 +1,37 @@
resource "proxmox_lxc" "omada" {
target_node = "pve"
vmid = "200"
hostname = "omada"
ostemplate = "local:vztmpl/debian-12-standard_12.7-1_amd64.tar.zst"
password = var.ci_password
unprivileged = false
ostype = "debian"
start = true
startup = "order=1000"
ssh_public_keys = <<EOF
${var.ssh_key}
EOF
memory = "4096"
swap = "512"
rootfs {
storage = "local-zfs"
size = "8G"
}
features {
fuse = true
nesting = true
mount = "nfs;cifs"
}
network {
name = "eth0"
bridge = "vmbr0"
ip = "10.10.40.2/24"
gw = "10.10.40.1"
tag = 40
}
}

View File

@ -7,8 +7,8 @@ bw sync
echo "Please wait while we prepare terraform.auto.tfvars" echo "Please wait while we prepare terraform.auto.tfvars"
proxmox_api_url=$(bw get --session $BW_SESSION uri proxmox_api) proxmox_api_url=$(bw get --session $BW_SESSION uri proxmox_api)
proxmox_api_token_id=$(bw get --session $BW_SESSION username proxmox_api) proxmox_api_token_id=$(bw get --session $BW_SESSION username f295a859-154a-482d-8129-c6ec6e06131e)
proxmox_api_token_secret=$(bw get --session $BW_SESSION password proxmox_api) proxmox_api_token_secret=$(bw get --session $BW_SESSION password f295a859-154a-482d-8129-c6ec6e06131e)
ci_user=$(bw get --session $BW_SESSION username ci_details) ci_user=$(bw get --session $BW_SESSION username ci_details)
ci_password=$(bw get --session $BW_SESSION password ci_details) ci_password=$(bw get --session $BW_SESSION password ci_details)
ssh_key=$(bw get --session $BW_SESSION notes ssh_public_key_main) ssh_key=$(bw get --session $BW_SESSION notes ssh_public_key_main)
@ -18,9 +18,7 @@ tfusername=$(bw get --session $BW_SESSION username tofu_postgres)
tfpassword=$(bw get --session $BW_SESSION password tofu_postgres) tfpassword=$(bw get --session $BW_SESSION password tofu_postgres)
tfurl=$(bw get --session $BW_SESSION uri tofu_postgres) tfurl=$(bw get --session $BW_SESSION uri tofu_postgres)
echo 'proxmox_api_url = "'$proxmox_api_url'"' > terraform.auto.tfvars
echo 'proxmox_api_url = "'$proxmox_api_url'"' >> terraform.auto.tfvars
echo 'proxmox_api_token_id = "'$proxmox_api_token_id'"' >> terraform.auto.tfvars echo 'proxmox_api_token_id = "'$proxmox_api_token_id'"' >> terraform.auto.tfvars
echo 'proxmox_api_token_secret = "'$proxmox_api_token_secret'"' >> terraform.auto.tfvars echo 'proxmox_api_token_secret = "'$proxmox_api_token_secret'"' >> terraform.auto.tfvars
echo 'ci_user = "'$ci_user'"' >> terraform.auto.tfvars echo 'ci_user = "'$ci_user'"' >> terraform.auto.tfvars
@ -31,8 +29,6 @@ echo 'passphrase = "'$passphrase'"' >> terraform.auto.tfvars
echo 'tfusername = "'$tfusername'"' >> terraform.auto.tfvars echo 'tfusername = "'$tfusername'"' >> terraform.auto.tfvars
echo 'tfpassword = "'$tfpassword'"' >> terraform.auto.tfvars echo 'tfpassword = "'$tfpassword'"' >> terraform.auto.tfvars
echo 'tfurl = "'$tfurl'"' >> terraform.auto.tfvars echo 'tfurl = "'$tfurl'"' >> terraform.auto.tfvars
echo 'lxc_template = "debian-12-standard_12.7-1_amd64.tar.zst"' >> terraform.auto.tfvars echo 'lxc_template = "debian-12-standard_12.7-1_amd64.tar.zst"' >> terraform.auto.tfvars

View File

@ -91,8 +91,8 @@ variable "tfurl" {
provider "proxmox" { provider "proxmox" {
pm_api_url = var.proxmox_api_url pm_api_url = var.proxmox_api_url
pm_api_token_id = var.proxmox_api_token_id pm_user = "root@pam"
pm_api_token_secret = var.proxmox_api_token_secret pm_password = var.proxmox_api_token_secret
pm_timeout = 3600 pm_timeout = 3600
pm_parallel = 2 # Fix VM HDD lock timeout pm_parallel = 2 # Fix VM HDD lock timeout
# Optional: Skip TLS Verification # Optional: Skip TLS Verification