Hello everyone,
So far, I have successfully created Linux templates using Packer on Proxmox. Now, I am looking to do the same for Windows 10, but I haven’t been able to make it work. Is there anyone here who can assist me with this or perhaps has a Packer file that accomplishes this? I would greatly appreciate any help.
My file looks like this at the moment
variable "proxmox_url" {
default = "https://myproxmox:8006/api2/json"
}
variable "proxmox_host" {
default = "proxmox"
}
variable "proxmox_username" {
default = "myuser@pam!packer"
}
variable "proxmox_password" {
default = "my-token"
}
variable "winrm_username" {
default = "vagrant"
}
variable "winrm_password" {
default = "vagrant"
}
variable "vm_name" {
default = "win10"
}
variable "template_description" {
default = "test"
}
variable "iso_file" {
default = "local:iso/Windows10-template.iso"
}
variable "vm_cpu_cores" {
default = 4
}
variable "vm_memory" {
default = "8192"
}
variable "vm_disk_size" {
default = "100G"
}
variable "autounattend" {
default = "./answer_files/10/Autounattend.xml"
}
variable "disks" {
description = "Hard Disks for the VM."
type = map(object({
size = string
type = string
storage_pool = string
}))
default = {
"0" = {
size = "100G"
type = "scsi"
storage_pool = "Storage"
}
}
}
build {
sources = [
"source.proxmox.autogenerated_2"
]
}
source "proxmox" "autogenerated_2" {
type = "proxmox"
node = var.proxmox_host
proxmox_url = var.proxmox_url
insecure_skip_tls_verify = true
username = var.proxmox_username
password = var.proxmox_password
vm_name = var.vm_name
template_description = var.template_description
iso_file = var.iso_file
memory = var.vm_memory
cores = var.vm_cpu_cores
os = "win10"
network_adapters {
bridge = "vmbr9"
model = "e1000"
vlan_tag = ""
}
dynamic "disks" {
for_each = var.disks
content {
disk_size = disks.value.size
type = disks.value.type
storage_pool = disks.value.storage_pool
}
}
additional_iso_files = [
{
device = "sata3"
iso_url = "./answer_files/10/Autounattend.iso"
iso_checksum = "137a02a6c9321f2058610c9d5b26dd37"
iso_storage_pool = "ISO-storage"
unmount = true
},
{
device = "sata4"
iso_url = "ISO-storage:iso/virtio-win-0.1.185.iso"
unmount = true
}
]
communicator = "winrm"
winrm_username = var.winrm_username
winrm_password = var.winrm_password
winrm_insecure = true
winrm_use_ssl = true
}
#provisioner "windows-shell" {
# type = "windows-shell"
# scripts = [
# "scripts/disablewinupdate.bat"
# ]
#}
#
#provisioner "powershell" {
# type = "powershell"
# scripts = [
# "scripts/disable-hibernate.ps1"
# ]
#}