diff --git a/AI.tf b/AI.tf new file mode 100644 index 0000000..31204c3 --- /dev/null +++ b/AI.tf @@ -0,0 +1,71 @@ +resource "proxmox_virtual_environment_vm" "AI" { + + # VM General Settings + node_name = "pve2" + vm_id = 322 + name = "AI" + machine = "q35" + description = "Ollama, Open Webui, mindsdb" + tags = ["tofu", "ubuntu-22", "auto-homelab-repo"] + started = true + + agent { + enabled = true + } + + clone { + vm_id = 8101 + } + + # VM CPU Settings + cpu { + cores = 10 + type = "host" + architecture = "x86_64" + } + + # VM Memory Settings + memory { + dedicated = 16384 + } + + # VM Network Settings + network_device { + bridge = "vmbr0" + vlan_id = 1 + } + + # VM Disk Settings + disk { + datastore_id = "local-lvm" + size = 100 + interface = "scsi0" + } + + + hostpci { + device = "hostpci0" + pcie = true + mapping = "gpu2" + rombar = true + } + + initialization { + ip_config { + ipv4 { + address = "dhcp" + } + } + + user_data_file_id = proxmox_virtual_environment_file.cloud_config2.id + } + + lifecycle { + ignore_changes = [ + initialization[0].user_account[0].keys, + initialization[0].user_account[0].password, + initialization[0].user_account[0].username, + ] + } + +} diff --git a/authentik.tf b/authentik.tf new file mode 100644 index 0000000..f575117 --- /dev/null +++ b/authentik.tf @@ -0,0 +1,63 @@ +resource "proxmox_virtual_environment_vm" "authentik" { + + # VM General Settings + node_name = "pve2" + vm_id = 323 + name = "authentik" + tags = ["tofu", "ubuntu-22", "auto-homelab-repo"] + started = true + + agent { + enabled = true + } + + clone { + vm_id = 8101 + } + + # VM CPU Settings + cpu { + cores = 4 + type = "host" + architecture = "x86_64" + } + + # VM Memory Settings + memory { + dedicated = 4096 + } + + # VM Network Settings + network_device { + bridge = "vmbr0" + vlan_id = 0 + } + + # VM Disk Settings + disk { + datastore_id = "" + size = 64 + interface = "scsi0" + } + + serial_device {} + + initialization { + ip_config { + ipv4 { + address = "dhcp" + } + } + + user_data_file_id = proxmox_virtual_environment_file.cloud_config2.id + } + + lifecycle { + ignore_changes = [ + initialization[0].user_account[0].keys, + initialization[0].user_account[0].password, + initialization[0].user_account[0].username, + ] + } + +} diff --git a/provider.tf b/provider.tf index fa0ecb2..a532e63 100644 --- a/provider.tf +++ b/provider.tf @@ -3,7 +3,7 @@ terraform { required_providers { proxmox = { source = "bpg/proxmox" - version = ">= 0.60.0" + version = ">= 0.60.1" } } } diff --git a/ubuntu22-template2.tf b/ubuntu22-template2.tf index 49bf81a..e7d6f75 100644 --- a/ubuntu22-template2.tf +++ b/ubuntu22-template2.tf @@ -8,7 +8,7 @@ resource "proxmox_virtual_environment_vm" "Ubuntu-22-Template2" { disk { datastore_id = "local-lvm" - file_id = proxmox_virtual_environment_download_file.ubuntu_cloud_image_22_2.id + file_id = "local:iso/jammy-server-cloudimg-amd64.img" interface = "scsi0" size = 4 } @@ -38,11 +38,3 @@ vga { } } - - -resource "proxmox_virtual_environment_download_file" "ubuntu_cloud_image_22_2" { - content_type = "iso" - datastore_id = "local" - node_name = "pve2" - url = "https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img" -}