added too much too remeber

This commit is contained in:
Petar Cubela
2025-09-18 22:43:15 +02:00
parent 4025e0fb36
commit b023b1f287
10 changed files with 311 additions and 82 deletions

View File

@@ -2,8 +2,7 @@ proxmox_api_url = "https://pve.lab.softbox.net:8006/api2/json"
proxmox_api_token_id = "root@pam!tofu"
proxmox_api_token_secret = "abb30a27-6d10-4d1e-8f3c-a02c355b3ee9"
#lxc_passwd = "reliyyaeknpt3"
#vm_passwd = "reliyyaeknpt3"
#lxc_passwd = "!aladin123"
ssh_public_key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBzh23ZkSVNbmDKk9esAT9qNkOoYFLhpX2nSLKPJaDVZ petar.cubela@sbx-mac-lab.local"
#ssh_private_key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBzh23ZkSVNbmDKk9esAT9qNkOoYFLhpX2nSLKPJaDVZ petar.cubela@sbx-mac-lab.local"

33
lxc-demo-1.tf Normal file
View File

@@ -0,0 +1,33 @@
# 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 = "500"
#
# ssh_public_keys = var.ssh_public_key
#
#
# features {
# nesting = true
# }
# hostname = "lxc-demo-1"
#
# network {
# name = "eth1"
# bridge = "vmbr0"
# ip = "dhcp"
# ip6 = "auto"
# }
#
# rootfs {
# storage = "local-lvm"
# size = "8G"
# }
#
# }

View File

@@ -61,7 +61,5 @@
# cicustom = "vendor=local:snippets/qemu-guest-agent.yml" # /var/lib/vz/snippets/qemu-guest-agent.yml
# ciupgrade = true
#
# sshkeys = <<EOF
# ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBzh23ZkSVNbmDKk9esAT9qNkOoYFLhpX2nSLKPJaDVZ petar.cubela@sbx-mac-lab.local
# EOF
# sshkeys = var.public_ssh_key
#}

67
templates/vm-students.tf Normal file
View File

@@ -0,0 +1,67 @@
#resource "proxmox_vm_qemu" "vm-student-1" {
# name = "sbx-srv-student01"
#
# # 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 = "sbxadmin"
# cicustom = "vendor=local:snippets/qemu-guest-agent.yml" # /var/lib/vz/snippets/qemu-guest-agent.yml
# ciupgrade = true
#
# sshkeys = <<EOF
# ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFbNAiSIW7pAVTsUPwkeyvhCSpNJ6HCLXlS8+jQOag4r niall@sbx-win
# EOF
#}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

69
vm_ad_client.tf Normal file
View File

@@ -0,0 +1,69 @@
resource "proxmox_vm_qemu" "vm_ad_client" {
name = "ad-client"
# 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 = "template-24.04-noble"
# Activate QEMU agent for this VM
agent = 1
os_type = "cloud-init"
vmid = 115
vm_state = "stopped"
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:cb:31"
}
nameserver = "10.11.12.67,10.11.12.254"
onboot = true
boot = "order=scsi0"
tags = "ldap,samba,kerberos,dns,pki"
# Setup the ip address using cloud-init.
# Keep in mind to use the CIDR notation for the ip.
ipconfig0 = "ip=10.11.12.13/24,gw=10.11.12.254"
ciuser = "sbxadmin"
cicustom = "vendor=local:snippets/qemu-guest-agent.yml,user=local:snippets/cloud_init_fedora_vm_ipa.yml" # /var/lib/vz/snippets/qemu-guest-agent.yml
ciupgrade = true
sshkeys = var.ssh_public_key
}

View File

@@ -52,7 +52,7 @@ resource "proxmox_vm_qemu" "vm-freeipa" {
bridge = "vmbr0"
macaddr = "bc:24:11:de:cb:30"
}
nameserver = "9.9.9.9"
nameserver = "9.9.9.9,10.11.12.254"
onboot = true
boot = "order=scsi0"
@@ -65,7 +65,5 @@ resource "proxmox_vm_qemu" "vm-freeipa" {
cicustom = "vendor=local:snippets/qemu-guest-agent.yml,user=local:snippets/cloud_init_fedora_vm_ipa.yml" # /var/lib/vz/snippets/qemu-guest-agent.yml
ciupgrade = true
sshkeys = <<EOF
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBzh23ZkSVNbmDKk9esAT9qNkOoYFLhpX2nSLKPJaDVZ petar.cubela@sbx-mac-lab.local
EOF
sshkeys = var.ssh_public_key
}

View File

@@ -1,71 +1,69 @@
#resource "proxmox_vm_qemu" "vm_freeipa_client" {
# name = "ipa-client"
#
# # 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-fedora-38"
#
# # Activate QEMU agent for this VM
# agent = 1
#
# os_type = "cloud-init"
# vmid = 113
# vm_state = "stopped"
#
# 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:cb:31"
# }
# nameserver = "10.11.12.65,10.11.12.254"
#
# onboot = true
# boot = "order=scsi0"
# tags = "ldap,samba,kerberos,dns,pki"
#
# # Setup the ip address using cloud-init.
# # Keep in mind to use the CIDR notation for the ip.
# ipconfig0 = "ip=10.11.12.13/24,gw=10.11.12.254"
# ciuser = "sbxadmin"
# cicustom = "vendor=local:snippets/qemu-guest-agent.yml" # /var/lib/vz/snippets/qemu-guest-agent.yml
# ciupgrade = true
#
# sshkeys = <<EOF
# ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBzh23ZkSVNbmDKk9esAT9qNkOoYFLhpX2nSLKPJaDVZ petar.cubela@sbx-mac-lab.local
# EOF
#}
resource "proxmox_vm_qemu" "vm_freeipa_client" {
name = "ipa-client"
# 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 = "template-24.04-noble"
# Activate QEMU agent for this VM
agent = 1
os_type = "cloud-init"
vmid = 113
vm_state = "stopped"
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:cb:31"
}
nameserver = "10.11.12.64,10.11.12.254"
onboot = true
boot = "order=scsi0"
tags = "ldap,samba,kerberos,dns,pki"
# Setup the ip address using cloud-init.
# Keep in mind to use the CIDR notation for the ip.
ipconfig0 = "ip=10.11.12.13/24,gw=10.11.12.254"
ciuser = "sbxadmin"
cicustom = "vendor=local:snippets/qemu-guest-agent.yml,user=local:snippets/cloud_init_fedora_vm_ipa.yml" # /var/lib/vz/snippets/qemu-guest-agent.yml
ciupgrade = true
sshkeys = var.ssh_public_key
}

67
vm_students.tf Normal file
View File

@@ -0,0 +1,67 @@
resource "proxmox_vm_qemu" "vm-student-1" {
name = "student01"
# 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 = 1000
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"
}
boot = "order=scsi0"
tags = "test,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.201/24,gw=10.11.12.254"
ciuser = "sbxadmin"
cicustom = "vendor=local:snippets/qemu-guest-agent.yml" # /var/lib/vz/snippets/qemu-guest-agent.yml
ciupgrade = true
sshkeys = var.ssh_public_key
}