Forráskód Böngészése

Merge pull request #709 from thault/main

Update Packer config and readme
Christian Lempa 1 éve
szülő
commit
a72f948987

+ 28 - 0
packer/proxmox/README.md

@@ -1,3 +1,31 @@
 # Packer Proxmox
 # Packer Proxmox
 
 
 You can add an additional description here.
 You can add an additional description here.
+
+## Installing Proxmox plugin
+You have two options:
+- You can add this config block to your pkr.hcl file and run ```packer init```.
+
+```
+packer {
+  required_plugins {
+    name = {
+      version = "~> 1"
+      source  = "github.com/hashicorp/proxmox"
+    }
+  }
+}
+```
+
+- Run ```packer plugins install github.com/hashicorp/proxmox``` to install the plugin globally in packer.
+
+## Running Packer
+
+1. Navigate into the folder you want to create a template with
+2. Run ```packer build -var-file ../credentials.pkr.hcl .```
+
+
+## Troubleshooting 
+- If you have tailscale installed, be aware that packer could grab the IP of your tailscale adapter rather than your LAN. You can either hard code the IP in the boot command or try setting the ```http_interface``` option
+- Sometimes the boot command is typed too fast and can cause issues. You can increase the time between types by using the ```boot_key_interval``` option.
+

+ 39 - 26
packer/proxmox/ubuntu-server-focal-docker/ubuntu-server-focal-docker.pkr.hcl

@@ -12,35 +12,46 @@ variable "proxmox_api_token_id" {
 }
 }
 
 
 variable "proxmox_api_token_secret" {
 variable "proxmox_api_token_secret" {
-    type = string
+    type      = string
     sensitive = true
     sensitive = true
 }
 }
 
 
+locals {
+    disk_storage = "local-lvm"
+}
+
 # Resource Definiation for the VM Template
 # Resource Definiation for the VM Template
 source "proxmox" "ubuntu-server-focal-docker" {
 source "proxmox" "ubuntu-server-focal-docker" {
 
 
     # Proxmox Connection Settings
     # Proxmox Connection Settings
     proxmox_url = "${var.proxmox_api_url}"
     proxmox_url = "${var.proxmox_api_url}"
-    username = "${var.proxmox_api_token_id}"
-    token = "${var.proxmox_api_token_secret}"
+    username    = "${var.proxmox_api_token_id}"
+    token       = "${var.proxmox_api_token_secret}"
     # (Optional) Skip TLS Verification
     # (Optional) Skip TLS Verification
     # insecure_skip_tls_verify = true
     # insecure_skip_tls_verify = true
 
 
     # VM General Settings
     # VM General Settings
-    node = "your-proxmox-node"
-    vm_id = "100"
-    vm_name = "ubuntu-server-focal-docker"
+    node                 = "your-proxmox-node"
+    vm_id                = "100"
+    vm_name              = "ubuntu-server-focal-docker"
     template_description = "Ubuntu Server Focal Image with Docker pre-installed"
     template_description = "Ubuntu Server Focal Image with Docker pre-installed"
 
 
     # VM OS Settings
     # VM OS Settings
     # (Option 1) Local ISO File
     # (Option 1) Local ISO File
-    # iso_file = "local:iso/ubuntu-20.04.2-live-server-amd64.iso"
-    # - or -
+    # boot_iso {
+    #     type         = "scsi"
+    #     iso_file     = "local:iso/ubuntu-20.04.2-live-server-amd64.iso"
+    #     unmount      = true
+    #     iso_checksum = "f8e3086f3cea0fb3fefb29937ab5ed9d19e767079633960ccb50e76153effc98"
+    # }
     # (Option 2) Download ISO
     # (Option 2) Download ISO
-    # iso_url = "https://releases.ubuntu.com/20.04/ubuntu-20.04.3-live-server-amd64.iso"
-    # iso_checksum = "f8e3086f3cea0fb3fefb29937ab5ed9d19e767079633960ccb50e76153effc98"
-    iso_storage_pool = "local"
-    unmount_iso = true
+    # boot_iso {
+    #     type             = "scsi"
+    #     iso_url          = "https://releases.ubuntu.com/20.04/ubuntu-20.04.3-live-server-amd64.iso"
+    #     unmount          = true
+    #     iso_storage_pool = "local"
+    #     iso_checksum     = "file:https://releases.ubuntu.com/focal/SHA256SUMS"
+    # }
 
 
     # VM System Settings
     # VM System Settings
     qemu_agent = true
     qemu_agent = true
@@ -49,11 +60,10 @@ source "proxmox" "ubuntu-server-focal-docker" {
     scsi_controller = "virtio-scsi-pci"
     scsi_controller = "virtio-scsi-pci"
 
 
     disks {
     disks {
-        disk_size = "20G"
-        format = "qcow2"
-        storage_pool = "local-lvm"
-        storage_pool_type = "lvm"
-        type = "virtio"
+        disk_size         = "25G"
+        format            = "qcow2"
+        storage_pool      = ${local.disk_storage}
+        type              = "virtio"
     }
     }
 
 
     # VM CPU Settings
     # VM CPU Settings
@@ -64,16 +74,18 @@ source "proxmox" "ubuntu-server-focal-docker" {
 
 
     # VM Network Settings
     # VM Network Settings
     network_adapters {
     network_adapters {
-        model = "virtio"
-        bridge = "vmbr0"
+        model    = "virtio"
+        bridge   = "vmbr0"
         firewall = "false"
         firewall = "false"
     }
     }
 
 
     # VM Cloud-Init Settings
     # VM Cloud-Init Settings
-    cloud_init = true
-    cloud_init_storage_pool = "local-lvm"
+    cloud_init              = true
+    cloud_init_storage_pool = ${local.disk_storage}
 
 
     # PACKER Boot Commands
     # PACKER Boot Commands
+    boot         = "c"
+    boot_wait    = "5s"
     boot_command = [
     boot_command = [
         "<esc><wait><esc><wait>",
         "<esc><wait><esc><wait>",
         "<f6><wait><esc><wait>",
         "<f6><wait><esc><wait>",
@@ -81,15 +93,16 @@ source "proxmox" "ubuntu-server-focal-docker" {
         "autoinstall ds=nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ ",
         "autoinstall ds=nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ ",
         "--- <enter>"
         "--- <enter>"
     ]
     ]
-    boot = "c"
-    boot_wait = "5s"
+    # Useful for debugging
+    # Sometimes lag will require this
+    # boot_key_interval = "500ms"
 
 
     # PACKER Autoinstall Settings
     # PACKER Autoinstall Settings
     http_directory = "http"
     http_directory = "http"
     # (Optional) Bind IP Address and Port
     # (Optional) Bind IP Address and Port
     # http_bind_address = "0.0.0.0"
     # http_bind_address = "0.0.0.0"
-    # http_port_min = 8802
-    # http_port_max = 8802
+    # http_port_min     = 8802
+    # http_port_max     = 8802
 
 
     ssh_username = "your-user-name"
     ssh_username = "your-user-name"
 
 
@@ -126,7 +139,7 @@ build {
 
 
     # Provisioning the VM Template for Cloud-Init Integration in Proxmox #2
     # Provisioning the VM Template for Cloud-Init Integration in Proxmox #2
     provisioner "file" {
     provisioner "file" {
-        source = "files/99-pve.cfg"
+        source      = "files/99-pve.cfg"
         destination = "/tmp/99-pve.cfg"
         destination = "/tmp/99-pve.cfg"
     }
     }
 
 

+ 40 - 27
packer/proxmox/ubuntu-server-focal/ubuntu-server-focal.pkr.hcl

@@ -12,35 +12,46 @@ variable "proxmox_api_token_id" {
 }
 }
 
 
 variable "proxmox_api_token_secret" {
 variable "proxmox_api_token_secret" {
-    type = string
+    type      = string
     sensitive = true
     sensitive = true
 }
 }
 
 
+locals {
+    disk_storage = "local-lvm"
+}
+
 # Resource Definiation for the VM Template
 # Resource Definiation for the VM Template
 source "proxmox" "ubuntu-server-focal" {
 source "proxmox" "ubuntu-server-focal" {
 
 
     # Proxmox Connection Settings
     # Proxmox Connection Settings
     proxmox_url = "${var.proxmox_api_url}"
     proxmox_url = "${var.proxmox_api_url}"
-    username = "${var.proxmox_api_token_id}"
-    token = "${var.proxmox_api_token_secret}"
+    username    = "${var.proxmox_api_token_id}"
+    token       = "${var.proxmox_api_token_secret}"
     # (Optional) Skip TLS Verification
     # (Optional) Skip TLS Verification
     # insecure_skip_tls_verify = true
     # insecure_skip_tls_verify = true
 
 
     # VM General Settings
     # VM General Settings
-    node = "your-proxmox-node"
-    vm_id = "100"
-    vm_name = "ubuntu-server-focal"
+    node                 = "your-proxmox-node"
+    vm_id                = "100"
+    vm_name              = "ubuntu-server-focal"
     template_description = "Ubuntu Server Focal Image"
     template_description = "Ubuntu Server Focal Image"
 
 
     # VM OS Settings
     # VM OS Settings
     # (Option 1) Local ISO File
     # (Option 1) Local ISO File
-    # iso_file = "local:iso/ubuntu-20.04.2-live-server-amd64.iso"
-    # - or -
+    # boot_iso {
+    #     type         = "scsi"
+    #     iso_file     = "local:iso/ubuntu-20.04.2-live-server-amd64.iso"
+    #     unmount      = true
+    #     iso_checksum = "f8e3086f3cea0fb3fefb29937ab5ed9d19e767079633960ccb50e76153effc98"
+    # }
     # (Option 2) Download ISO
     # (Option 2) Download ISO
-    # iso_url = "https://releases.ubuntu.com/20.04/ubuntu-20.04.3-live-server-amd64.iso"
-    # iso_checksum = "f8e3086f3cea0fb3fefb29937ab5ed9d19e767079633960ccb50e76153effc98"
-    iso_storage_pool = "local"
-    unmount_iso = true
+    # boot_iso {
+    #     type             = "scsi"
+    #     iso_url          = "https://releases.ubuntu.com/20.04/ubuntu-20.04.3-live-server-amd64.iso"
+    #     unmount          = true
+    #     iso_storage_pool = "local"
+    #     iso_checksum     = "file:https://releases.ubuntu.com/focal/SHA256SUMS"
+    # }
 
 
     # VM System Settings
     # VM System Settings
     qemu_agent = true
     qemu_agent = true
@@ -49,11 +60,10 @@ source "proxmox" "ubuntu-server-focal" {
     scsi_controller = "virtio-scsi-pci"
     scsi_controller = "virtio-scsi-pci"
 
 
     disks {
     disks {
-        disk_size = "20G"
-        format = "qcow2"
-        storage_pool = "local-lvm"
-        storage_pool_type = "lvm"
-        type = "virtio"
+        disk_size         = "25G"
+        format            = "qcow2"
+        storage_pool      = ${local.disk_storage}
+        type              = "virtio"
     }
     }
 
 
     # VM CPU Settings
     # VM CPU Settings
@@ -64,16 +74,18 @@ source "proxmox" "ubuntu-server-focal" {
 
 
     # VM Network Settings
     # VM Network Settings
     network_adapters {
     network_adapters {
-        model = "virtio"
-        bridge = "vmbr0"
+        model    = "virtio"
+        bridge   = "vmbr0"
         firewall = "false"
         firewall = "false"
     }
     }
 
 
     # VM Cloud-Init Settings
     # VM Cloud-Init Settings
-    cloud_init = true
-    cloud_init_storage_pool = "local-lvm"
+    cloud_init              = true
+    cloud_init_storage_pool = ${local.disk_storage}
 
 
     # PACKER Boot Commands
     # PACKER Boot Commands
+    boot         = "c"
+    boot_wait    = "5s"
     boot_command = [
     boot_command = [
         "<esc><wait><esc><wait>",
         "<esc><wait><esc><wait>",
         "<f6><wait><esc><wait>",
         "<f6><wait><esc><wait>",
@@ -81,15 +93,16 @@ source "proxmox" "ubuntu-server-focal" {
         "autoinstall ds=nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ ",
         "autoinstall ds=nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ ",
         "--- <enter>"
         "--- <enter>"
     ]
     ]
-    boot = "c"
-    boot_wait = "5s"
+    # Useful for debugging
+    # Sometimes lag will require this
+    # boot_key_interval = "500ms"
 
 
     # PACKER Autoinstall Settings
     # PACKER Autoinstall Settings
     http_directory = "http"
     http_directory = "http"
     # (Optional) Bind IP Address and Port
     # (Optional) Bind IP Address and Port
     # http_bind_address = "0.0.0.0"
     # http_bind_address = "0.0.0.0"
-    # http_port_min = 8802
-    # http_port_max = 8802
+    # http_port_min     = 8802
+    # http_port_max     = 8802
 
 
     ssh_username = "your-user-name"
     ssh_username = "your-user-name"
 
 
@@ -106,7 +119,7 @@ source "proxmox" "ubuntu-server-focal" {
 # Build Definition to create the VM Template
 # Build Definition to create the VM Template
 build {
 build {
 
 
-    name = "ubuntu-server-focal"
+    name    = "ubuntu-server-focal"
     sources = ["source.proxmox.ubuntu-server-focal"]
     sources = ["source.proxmox.ubuntu-server-focal"]
 
 
     # Provisioning the VM Template for Cloud-Init Integration in Proxmox #1
     # Provisioning the VM Template for Cloud-Init Integration in Proxmox #1
@@ -126,7 +139,7 @@ build {
 
 
     # Provisioning the VM Template for Cloud-Init Integration in Proxmox #2
     # Provisioning the VM Template for Cloud-Init Integration in Proxmox #2
     provisioner "file" {
     provisioner "file" {
-        source = "files/99-pve.cfg"
+        source      = "files/99-pve.cfg"
         destination = "/tmp/99-pve.cfg"
         destination = "/tmp/99-pve.cfg"
     }
     }
 
 

+ 39 - 26
packer/proxmox/ubuntu-server-jammy-docker/ubuntu-server-jammy-docker.pkr.hcl

@@ -12,35 +12,46 @@ variable "proxmox_api_token_id" {
 }
 }
 
 
 variable "proxmox_api_token_secret" {
 variable "proxmox_api_token_secret" {
-    type = string
+    type      = string
     sensitive = true
     sensitive = true
 }
 }
 
 
+locals {
+    disk_storage = "local-lvm"
+}
+
 # Resource Definiation for the VM Template
 # Resource Definiation for the VM Template
 source "proxmox" "ubuntu-server-jammy" {
 source "proxmox" "ubuntu-server-jammy" {
 
 
     # Proxmox Connection Settings
     # Proxmox Connection Settings
     proxmox_url = "${var.proxmox_api_url}"
     proxmox_url = "${var.proxmox_api_url}"
-    username = "${var.proxmox_api_token_id}"
-    token = "${var.proxmox_api_token_secret}"
+    username    = "${var.proxmox_api_token_id}"
+    token       = "${var.proxmox_api_token_secret}"
     # (Optional) Skip TLS Verification
     # (Optional) Skip TLS Verification
     # insecure_skip_tls_verify = true
     # insecure_skip_tls_verify = true
 
 
     # VM General Settings
     # VM General Settings
-    node = "your-proxmox-node"
-    vm_id = "100"
-    vm_name = "ubuntu-server-jammy"
+    node                 = "your-proxmox-node"
+    vm_id                = "100"
+    vm_name              = "ubuntu-server-jammy"
     template_description = "Ubuntu Server jammy Image"
     template_description = "Ubuntu Server jammy Image"
 
 
     # VM OS Settings
     # VM OS Settings
     # (Option 1) Local ISO File
     # (Option 1) Local ISO File
-    # iso_file = "local:iso/ubuntu-22.04-live-server-amd64.iso"
-    # - or -
+    # boot_iso {
+    #     type         = "scsi"
+    #     iso_file     = "local:iso/ubuntu-22.04-live-server-amd64.iso"
+    #     unmount      = true
+    #     iso_checksum = "84aeaf7823c8c61baa0ae862d0a06b03409394800000b3235854a6b38eb4856f"
+    # }
     # (Option 2) Download ISO
     # (Option 2) Download ISO
-    # iso_url = "https://releases.ubuntu.com/22.04/ubuntu-22.04-live-server-amd64.iso"
-    # iso_checksum = "84aeaf7823c8c61baa0ae862d0a06b03409394800000b3235854a6b38eb4856f"
-    iso_storage_pool = "local"
-    unmount_iso = true
+    # boot_iso {
+    #     type             = "scsi"
+    #     iso_url          = "https://releases.ubuntu.com/22.04/ubuntu-22.04-live-server-amd64.iso"
+    #     unmount          = true
+    #     iso_storage_pool = "local"
+    #     iso_checksum     = "file:https://releases.ubuntu.com/jammy/SHA256SUMS"
+    # }
 
 
     # VM System Settings
     # VM System Settings
     qemu_agent = true
     qemu_agent = true
@@ -49,11 +60,10 @@ source "proxmox" "ubuntu-server-jammy" {
     scsi_controller = "virtio-scsi-pci"
     scsi_controller = "virtio-scsi-pci"
 
 
     disks {
     disks {
-        disk_size = "20G"
-        format = "qcow2"
-        storage_pool = "local-lvm"
-        storage_pool_type = "lvm"
-        type = "virtio"
+        disk_size         = "20G"
+        format            = "qcow2"
+        storage_pool      = ${local.disk_storage}
+        type              = "virtio"
     }
     }
 
 
     # VM CPU Settings
     # VM CPU Settings
@@ -64,16 +74,18 @@ source "proxmox" "ubuntu-server-jammy" {
 
 
     # VM Network Settings
     # VM Network Settings
     network_adapters {
     network_adapters {
-        model = "virtio"
-        bridge = "vmbr0"
+        model    = "virtio"
+        bridge   = "vmbr0"
         firewall = "false"
         firewall = "false"
     }
     }
 
 
     # VM Cloud-Init Settings
     # VM Cloud-Init Settings
-    cloud_init = true
-    cloud_init_storage_pool = "local-lvm"
+    cloud_init              = true
+    cloud_init_storage_pool = ${local.disk_storage}
 
 
     # PACKER Boot Commands
     # PACKER Boot Commands
+    boot = "c"
+    boot_wait = "5s"
     boot_command = [
     boot_command = [
         "<esc><wait>",
         "<esc><wait>",
         "e<wait>",
         "e<wait>",
@@ -82,15 +94,16 @@ source "proxmox" "ubuntu-server-jammy" {
         "autoinstall ds=nocloud-net\\;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ ---<wait>",
         "autoinstall ds=nocloud-net\\;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ ---<wait>",
         "<f10><wait>"
         "<f10><wait>"
     ]
     ]
-    boot = "c"
-    boot_wait = "5s"
+    # Useful for debugging
+    # Sometimes lag will require this
+    # boot_key_interval = "500ms"
 
 
     # PACKER Autoinstall Settings
     # PACKER Autoinstall Settings
     http_directory = "http"
     http_directory = "http"
     # (Optional) Bind IP Address and Port
     # (Optional) Bind IP Address and Port
     # http_bind_address = "0.0.0.0"
     # http_bind_address = "0.0.0.0"
-    # http_port_min = 8802
-    # http_port_max = 8802
+    # http_port_min     = 8802
+    # http_port_max     = 8802
 
 
     ssh_username = "your-user-name"
     ssh_username = "your-user-name"
 
 
@@ -128,7 +141,7 @@ build {
 
 
     # Provisioning the VM Template for Cloud-Init Integration in Proxmox #2
     # Provisioning the VM Template for Cloud-Init Integration in Proxmox #2
     provisioner "file" {
     provisioner "file" {
-        source = "files/99-pve.cfg"
+        source      = "files/99-pve.cfg"
         destination = "/tmp/99-pve.cfg"
         destination = "/tmp/99-pve.cfg"
     }
     }
 
 

+ 39 - 26
packer/proxmox/ubuntu-server-jammy/ubuntu-server-jammy.pkr.hcl

@@ -12,35 +12,46 @@ variable "proxmox_api_token_id" {
 }
 }
 
 
 variable "proxmox_api_token_secret" {
 variable "proxmox_api_token_secret" {
-    type = string
+    type      = string
     sensitive = true
     sensitive = true
 }
 }
 
 
+locals {
+    disk_storage = "local-lvm"
+}
+
 # Resource Definiation for the VM Template
 # Resource Definiation for the VM Template
 source "proxmox-iso" "ubuntu-server-jammy" {
 source "proxmox-iso" "ubuntu-server-jammy" {
 
 
     # Proxmox Connection Settings
     # Proxmox Connection Settings
     proxmox_url = "${var.proxmox_api_url}"
     proxmox_url = "${var.proxmox_api_url}"
-    username = "${var.proxmox_api_token_id}"
-    token = "${var.proxmox_api_token_secret}"
+    username    = "${var.proxmox_api_token_id}"
+    token       = "${var.proxmox_api_token_secret}"
     # (Optional) Skip TLS Verification
     # (Optional) Skip TLS Verification
     # insecure_skip_tls_verify = true
     # insecure_skip_tls_verify = true
 
 
     # VM General Settings
     # VM General Settings
-    node = "your-proxmox-node"
-    vm_id = "100"
-    vm_name = "ubuntu-server-jammy"
+    node                 = "your-proxmox-node"
+    vm_id                = "100"
+    vm_name              = "ubuntu-server-jammy"
     template_description = "Ubuntu Server jammy Image"
     template_description = "Ubuntu Server jammy Image"
 
 
     # VM OS Settings
     # VM OS Settings
     # (Option 1) Local ISO File
     # (Option 1) Local ISO File
-    # iso_file = "local:iso/ubuntu-22.04-live-server-amd64.iso"
-    # - or -
+    # boot_iso {
+    #     type         = "scsi"
+    #     iso_file     = "local:iso/ubuntu-22.04-live-server-amd64.iso"
+    #     unmount      = true
+    #     iso_checksum = "84aeaf7823c8c61baa0ae862d0a06b03409394800000b3235854a6b38eb4856f"
+    # }
     # (Option 2) Download ISO
     # (Option 2) Download ISO
-    # iso_url = "https://releases.ubuntu.com/22.04/ubuntu-22.04-live-server-amd64.iso"
-    # iso_checksum = "84aeaf7823c8c61baa0ae862d0a06b03409394800000b3235854a6b38eb4856f"
-    iso_storage_pool = "local"
-    unmount_iso = true
+    # boot_iso {
+    #     type             = "scsi"
+    #     iso_url          = "https://releases.ubuntu.com/22.04/ubuntu-22.04-live-server-amd64.iso"
+    #     unmount          = true
+    #     iso_storage_pool = "local"
+    #     iso_checksum     = "file:https://releases.ubuntu.com/jammy/SHA256SUMS"
+    # }
 
 
     # VM System Settings
     # VM System Settings
     qemu_agent = true
     qemu_agent = true
@@ -49,11 +60,10 @@ source "proxmox-iso" "ubuntu-server-jammy" {
     scsi_controller = "virtio-scsi-pci"
     scsi_controller = "virtio-scsi-pci"
 
 
     disks {
     disks {
-        disk_size = "20G"
-        format = "qcow2"
-        storage_pool = "local-lvm"
-        storage_pool_type = "lvm"
-        type = "virtio"
+        disk_size         = "20G"
+        format            = "qcow2"
+        storage_pool      = ${local.disk_storage}
+        type              = "virtio"
     }
     }
 
 
     # VM CPU Settings
     # VM CPU Settings
@@ -64,16 +74,18 @@ source "proxmox-iso" "ubuntu-server-jammy" {
 
 
     # VM Network Settings
     # VM Network Settings
     network_adapters {
     network_adapters {
-        model = "virtio"
-        bridge = "vmbr0"
+        model    = "virtio"
+        bridge   = "vmbr0"
         firewall = "false"
         firewall = "false"
     }
     }
 
 
     # VM Cloud-Init Settings
     # VM Cloud-Init Settings
-    cloud_init = true
-    cloud_init_storage_pool = "local-lvm"
+    cloud_init              = true
+    cloud_init_storage_pool = ${local.disk_storage}
 
 
     # PACKER Boot Commands
     # PACKER Boot Commands
+    boot         = "c"
+    boot_wait    = "5s"
     boot_command = [
     boot_command = [
         "<esc><wait>",
         "<esc><wait>",
         "e<wait>",
         "e<wait>",
@@ -82,15 +94,16 @@ source "proxmox-iso" "ubuntu-server-jammy" {
         "autoinstall ds=nocloud-net\\;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ ---<wait>",
         "autoinstall ds=nocloud-net\\;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ ---<wait>",
         "<f10><wait>"
         "<f10><wait>"
     ]
     ]
-    boot = "c"
-    boot_wait = "5s"
+    # Useful for debugging
+    # Sometimes lag will require this
+    # boot_key_interval = "500ms"
 
 
     # PACKER Autoinstall Settings
     # PACKER Autoinstall Settings
     http_directory = "http"
     http_directory = "http"
     # (Optional) Bind IP Address and Port
     # (Optional) Bind IP Address and Port
     # http_bind_address = "0.0.0.0"
     # http_bind_address = "0.0.0.0"
-    # http_port_min = 8802
-    # http_port_max = 8802
+    # http_port_min     = 8802
+    # http_port_max     = 8802
 
 
     ssh_username = "your-user-name"
     ssh_username = "your-user-name"
 
 
@@ -128,7 +141,7 @@ build {
 
 
     # Provisioning the VM Template for Cloud-Init Integration in Proxmox #2
     # Provisioning the VM Template for Cloud-Init Integration in Proxmox #2
     provisioner "file" {
     provisioner "file" {
-        source = "files/99-pve.cfg"
+        source      = "files/99-pve.cfg"
         destination = "/tmp/99-pve.cfg"
         destination = "/tmp/99-pve.cfg"
     }
     }
 
 

+ 40 - 26
packer/proxmox/ubuntu-server-noble/ubuntu-server-noble.pkr.hcl

@@ -12,35 +12,46 @@ variable "proxmox_api_token_id" {
 }
 }
 
 
 variable "proxmox_api_token_secret" {
 variable "proxmox_api_token_secret" {
-    type = string
+    type      = string
     sensitive = true
     sensitive = true
 }
 }
 
 
+locals {
+    disk_storage = "local-lvm"
+}
+
 # Resource Definiation for the VM Template
 # Resource Definiation for the VM Template
 source "proxmox-iso" "ubuntu-server-noble" {
 source "proxmox-iso" "ubuntu-server-noble" {
 
 
     # Proxmox Connection Settings
     # Proxmox Connection Settings
     proxmox_url = "${var.proxmox_api_url}"
     proxmox_url = "${var.proxmox_api_url}"
-    username = "${var.proxmox_api_token_id}"
-    token = "${var.proxmox_api_token_secret}"
+    username    = "${var.proxmox_api_token_id}"
+    token       = "${var.proxmox_api_token_secret}"
     # (Optional) Skip TLS Verification
     # (Optional) Skip TLS Verification
     # insecure_skip_tls_verify = true
     # insecure_skip_tls_verify = true
 
 
     # VM General Settings
     # VM General Settings
-    node = "your-proxmox-node"
-    vm_id = "100"
-    vm_name = "ubuntu-server-noble"
+    node                 = "your-proxmox-node"
+    vm_id                = "100"
+    vm_name              = "ubuntu-server-noble"
     template_description = "Ubuntu Server Noble Image"
     template_description = "Ubuntu Server Noble Image"
 
 
     # VM OS Settings
     # VM OS Settings
     # (Option 1) Local ISO File
     # (Option 1) Local ISO File
-    # iso_file = "local:iso/ubuntu-24.04-live-server-amd64.iso"
-    # - or -
+    # boot_iso {
+    #     type         = "scsi"
+    #     iso_file     = "local:iso/ubuntu-24.04-live-server-amd64.iso"
+    #     unmount      = true
+    #     iso_checksum = "e240e4b801f7bb68c20d1356b60968ad0c33a41d00d828e74ceb3364a0317be9"
+    # }
     # (Option 2) Download ISO
     # (Option 2) Download ISO
-    # iso_url = "https://releases.ubuntu.com/24.04/ubuntu-24.04.2-live-server-amd64.iso"
-    # iso_checksum = "d6dab0c3a657988501b4bd76f1297c053df710e06e0c3aece60dead24f270b4d"
-    iso_storage_pool = "local"
-    unmount_iso = true
+    # boot_iso {
+    #     type             = "scsi"
+    #     iso_url          = "https://releases.ubuntu.com/24.04/ubuntu-24.04-live-server-amd64.iso"
+    #     unmount          = true
+    #     iso_storage_pool = "local"
+    #     iso_checksum     = "file:https://releases.ubuntu.com/noble/SHA256SUMS"
+    # }
 
 
     # VM System Settings
     # VM System Settings
     qemu_agent = true
     qemu_agent = true
@@ -49,11 +60,10 @@ source "proxmox-iso" "ubuntu-server-noble" {
     scsi_controller = "virtio-scsi-pci"
     scsi_controller = "virtio-scsi-pci"
 
 
     disks {
     disks {
-        disk_size = "20G"
-        format = "raw"
-        storage_pool = "local-lvm"
-        storage_pool_type = "lvm"
-        type = "virtio"
+        disk_size         = "25G"
+        format            = "qcow2"
+        storage_pool      = ${local.disk_storage}
+        type              = "virtio"
     }
     }
 
 
     # VM CPU Settings
     # VM CPU Settings
@@ -64,16 +74,19 @@ source "proxmox-iso" "ubuntu-server-noble" {
 
 
     # VM Network Settings
     # VM Network Settings
     network_adapters {
     network_adapters {
-        model = "virtio"
-        bridge = "vmbr0"
+        model    = "virtio"
+        bridge   = "vmbr0"
         firewall = "false"
         firewall = "false"
     }
     }
 
 
     # VM Cloud-Init Settings
     # VM Cloud-Init Settings
-    cloud_init = true
-    cloud_init_storage_pool = "local-lvm"
+    cloud_init              = true
+    cloud_init_storage_pool = ${local.disk_storage}
 
 
     # PACKER Boot Commands
     # PACKER Boot Commands
+    boot         = "c"
+    boot_wait    = "10s"
+    communicator = "ssh"
     boot_command = [
     boot_command = [
         "<esc><wait>",
         "<esc><wait>",
         "e<wait>",
         "e<wait>",
@@ -82,13 +95,14 @@ source "proxmox-iso" "ubuntu-server-noble" {
         "autoinstall ds=nocloud-net\\;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ ---<wait>",
         "autoinstall ds=nocloud-net\\;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ ---<wait>",
         "<f10><wait>"
         "<f10><wait>"
     ]
     ]
+    # Useful for debugging
+    # Sometimes lag will require this
+    # boot_key_interval = "500ms"
 
 
-    boot                    = "c"
-    boot_wait               = "10s"
-    communicator            = "ssh"
 
 
     # PACKER Autoinstall Settings
     # PACKER Autoinstall Settings
     http_directory          = "http"
     http_directory          = "http"
+
     # (Optional) Bind IP Address and Port
     # (Optional) Bind IP Address and Port
     # http_bind_address       = "0.0.0.0"
     # http_bind_address       = "0.0.0.0"
     # http_port_min           = 8802
     # http_port_min           = 8802
@@ -110,7 +124,7 @@ source "proxmox-iso" "ubuntu-server-noble" {
 # Build Definition to create the VM Template
 # Build Definition to create the VM Template
 build {
 build {
 
 
-    name = "ubuntu-server-noble"
+    name    = "ubuntu-server-noble"
     sources = ["source.proxmox-iso.ubuntu-server-noble"]
     sources = ["source.proxmox-iso.ubuntu-server-noble"]
 
 
     # Provisioning the VM Template for Cloud-Init Integration in Proxmox #1
     # Provisioning the VM Template for Cloud-Init Integration in Proxmox #1
@@ -131,7 +145,7 @@ build {
 
 
     # Provisioning the VM Template for Cloud-Init Integration in Proxmox #2
     # Provisioning the VM Template for Cloud-Init Integration in Proxmox #2
     provisioner "file" {
     provisioner "file" {
-        source = "files/99-pve.cfg"
+        source      = "files/99-pve.cfg"
         destination = "/tmp/99-pve.cfg"
         destination = "/tmp/99-pve.cfg"
     }
     }