windows-iac-vm-tooling/packer/windows.pkr.hcl

71 lines
1.6 KiB
HCL
Raw Normal View History

packer {
required_plugins {
proxmox = {
version = ">= 1.1.0"
source = "github.com/hashicorp/proxmox"
}
}
}
source "proxmox-iso" "windows-11" {
proxmox_url = "https://proxmox-host:8006/api2/json"
username = "root@pam"
password = "secret"
node = "la-vmh-07"
vm_name = "win11-ltsc-template"
template_description = "Built with Packer on ${timestamp()}"
iso_file = "local:iso/CLIENT_LTSC_EVAL_x64FRE_en-us.iso"
qemu_agent = true
cores = 4
memory = 8192
machine = "q35"
bios = "ovmf"
efi_config {
efi_storage_pool = "local-lvm"
pre_enrolled_keys = true
}
tpm_config {
version = "2.0"
tpm_storage_pool = "local-lvm"
}
scsi_controller = "virtio-scsi-pci"
disks {
disk_size = "60G"
storage_pool = "local-lvm"
type = "virtio"
format = "raw"
cache_mode = "writeback"
}
additional_iso_files {
device = "sata1"
iso_file = "local:iso/virtio-win.iso"
}
communicator = "winrm"
winrm_username = "Administrator"
winrm_password = "PackerPassword123!"
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"
]
}
}