Some checks are pending
Build and Release / build-sign-package (push) Waiting to run
- Added packer/variables.pkr.hcl with configurable variables - Added build-template.sh with interactive build script - Added .env.example for environment configuration - Updated windows.pkr.hcl to use variables - Supports environment variables and command line arguments
71 lines
1.7 KiB
HCL
71 lines
1.7 KiB
HCL
packer {
|
|
required_plugins {
|
|
proxmox = {
|
|
version = ">= 1.1.0"
|
|
source = "github.com/hashicorp/proxmox"
|
|
}
|
|
}
|
|
}
|
|
|
|
source "proxmox-iso" "windows-11" {
|
|
proxmox_url = "${var.proxmox_url}"
|
|
username = "${var.proxmox_username}"
|
|
password = "${var.proxmox_password}"
|
|
node = "${var.proxmox_node}"
|
|
|
|
vm_name = "${var.vm_name}"
|
|
template_description = "Built with Packer on ${timestamp()}"
|
|
iso_file = "${var.iso_storage}:iso/${var.windows_iso}"
|
|
|
|
qemu_agent = true
|
|
cores = "${var.vm_cores}"
|
|
memory = "${var.vm_memory}"
|
|
machine = "q35"
|
|
bios = "ovmf"
|
|
efi_config {
|
|
efi_storage_pool = "${var.disk_storage}"
|
|
pre_enrolled_keys = true
|
|
}
|
|
tpm_config {
|
|
version = "2.0"
|
|
tpm_storage_pool = "${var.disk_storage}"
|
|
}
|
|
|
|
scsi_controller = "virtio-scsi-pci"
|
|
disks {
|
|
disk_size = "${var.vm_disk_size}"
|
|
storage_pool = "${var.disk_storage}"
|
|
type = "virtio"
|
|
format = "raw"
|
|
cache_mode = "writeback"
|
|
}
|
|
|
|
additional_iso_files {
|
|
device = "sata1"
|
|
iso_file = "${var.virtio_iso}"
|
|
}
|
|
|
|
communicator = "winrm"
|
|
winrm_username = "Administrator"
|
|
winrm_password = "${var.winrm_password}"
|
|
winrm_insecure = true
|
|
winrm_use_ssl = true
|
|
|
|
boot_command = [
|
|
"<wait><wait><wait>", "<enter><wait>", "<enter><wait>",
|
|
"<enter><wait>", "<enter>"
|
|
]
|
|
boot_wait = "10s"
|
|
}
|
|
|
|
build {
|
|
sources = ["source.proxmox-iso.windows-11"]
|
|
|
|
provisioner "powershell" {
|
|
inline = [
|
|
"pnputil /add-driver 'E:\\viostor\\w11\\amd64\\*.inf' /install",
|
|
"pnputil /add-driver 'E:\\NetKVM\\w11\\amd64\\*.inf' /install",
|
|
"& 'E:\\virtio-win-guest-tools.exe' /install /passive /norestart"
|
|
]
|
|
}
|
|
}
|