init of new project root

This commit is contained in:
Petar Cubela
2025-09-20 19:56:03 +02:00
parent 8e6a8991c1
commit 8f7b06f951
8 changed files with 425 additions and 0 deletions

35
templates/lxc_demo_1.tf Normal file
View File

@@ -0,0 +1,35 @@
# variable "lxc_passwd" {
# type = string
# sensitive = true
# }
#
# resource "proxmox_lxc" "lxc_demo_1" {
# target_node = "pve"
# ostemplate = "local:vztmpl/debian-12-standard_12.7-1_amd64.tar.zst"
# password = var.lxc_passwd
# unprivileged = true
# vmid = "0"
#
# ssh_public_keys = <<-EOT
# ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBzh23ZkSVNbmDKk9esAT9qNkOoYFLhpX2nSLKPJaDVZ petar.cubela@sbx-mac-lab.local
# EOT
#
#
# features {
# nesting = true
# }
# hostname = "lxc-demo-1"
#
# network {
# name = "eth1"
# bridge = "vmbr1"
# ip = ""
# ip6 = "auto"
# }
#
# rootfs {
# storage = "local-zfs"
# size = "8G"
# }
#
# }

65
templates/vm_demo_1.tf Normal file
View File

@@ -0,0 +1,65 @@
#resource "proxmox_vm_qemu" "vm-demo-1" {
# name = "terraform-test-vm"
#
# # Node name has to be the same name as within the cluster
# # this might not include the FQDN
# target_node = "pve"
#
# # The template name to clone this vm from
# clone = "temp-debian-13"
#
# # Activate QEMU agent for this VM
# agent = 1
#
# os_type = "cloud-init"
# vmid = 0
#
# cpu {
# cores = 2
# sockets = 1
# type = "host"
# }
# memory = 2048
# scsihw = "virtio-scsi-single"
#
# # Setup the disk
# disks {
# scsi {
# scsi0 {
# # We have to specify the disk from our template, else Terraform will think it's not supposed to be there
# disk {
# storage = "local-zfs"
# # The size of the disk should be at least as big as the disk in the template. If it's smaller, the disk will be recreated
# size = "8G"
# }
# }
# }
# ide {
# # Some images require a cloud-init disk on the IDE controller, others on the SCSI or SATA controller
# ide1 {
# cloudinit {
# storage = "local-zfs"
# }
# }
# }
# }
# # Setup the network interface and assign a vlan tag: 256
#
# network {
# id = 0
# model = "virtio"
# bridge = "vmbr1"
# macaddr = "bc:24:11:de:ca:28"
# }
#
# boot = "order=scsi0"
#
# # Setup the ip address using cloud-init.
# # Keep in mind to use the CIDR notation for the ip.
# ipconfig0 = "ip6=auto"
# ciuser = "reliyya"
# cicustom = "vendor=local:snippets/qemu-guest-agent.yml" # /var/lib/vz/snippets/qemu-guest-agent.yml
# ciupgrade = true
#
# sshkeys = var.public_ssh_key
#}

70
templates/vm_students.tf Normal file
View File

@@ -0,0 +1,70 @@
resource "proxmox_vm_qemu" "vm_student_00" { # LOOP the resource name
name = "vm_00" # LOOP the name
# Node name has to be the same name as within the cluster
# this might not include the FQDN
target_node = "pve"
# The template name to clone this vm from
clone = var.student_vm_template
# Activate QEMU agent for this VM
agent = 1
os_type = "cloud-init"
vmid = 1000 # LOOP the vmid
vm_state = "running"
cpu {
cores = 2
sockets = 1
type = "host"
}
memory = 2048
scsihw = "virtio-scsi-pci"
# Setup the disk
disks {
scsi {
scsi0 {
# We have to specify the disk from our template, else Terraform will think it's not supposed to be there
disk {
storage = "local-lvm"
# The size of the disk should be at least as big as the disk in the template. If it's smaller, the disk will be recreated
size = "16G"
}
}
}
ide {
# Some images require a cloud-init disk on the IDE controller, others on the SCSI or SATA controller
ide1 {
cloudinit {
storage = "local-lvm"
}
}
}
}
# Setup the network interface and assign a vlan tag: 256
network {
id = 0
model = "virtio"
bridge = "vmbr0"
macaddr = "bc:24:11:de:c0:28" # LOOP the macaddres. each needs a unique one
}
boot = "order=scsi0"
tags = "student,deb"
# Setup the ip address using cloud-init.
# Keep in mind to use the CIDR notation for the ip.
ipconfig0 = "ip=10.11.12.199/24,gw=10.11.12.254" # LOOP the ipconfig. each needs a unique one
ciuser = "sbxadmin"
cicustom = "vendor=local:snippets/qemu-guest-agent.yml" # LOOP the cloud-init file if differences are needed
ciupgrade = true
sshkeys = var.petar_ssh_public_key
}