forked from rgl/windows-vagrant
-
Notifications
You must be signed in to change notification settings - Fork 0
/
windows-11-21h2-uefi.pkr.hcl
200 lines (178 loc) · 5.71 KB
/
windows-11-21h2-uefi.pkr.hcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
packer {
required_plugins {
windows-update = {
version = "0.14.0"
source = "github.com/rgl/windows-update"
}
}
}
variable "disk_size" {
type = string
default = "61440"
}
variable "iso_url" {
type = string
default = "https://software-download.microsoft.com/download/sg/888969d5-f34g-4e03-ac9d-1f9786c66749/22000.318.211104-1236.co_release_svc_refresh_CLIENTENTERPRISEEVAL_OEMRET_x64FRE_en-us.iso"
}
variable "iso_checksum" {
type = string
default = "sha256:684bc16adbd792ef2f7810158a3f387f23bf95e1aee5f16270c5b7f56db753b6"
}
variable "vagrant_box" {
type = string
}
source "qemu" "windows-11-21h2-uefi-amd64" {
accelerator = "kvm"
cpus = 2
memory = 4096
qemuargs = [
["-bios", "/usr/share/ovmf/OVMF.fd"],
["-cpu", "host"],
["-soundhw", "hda"],
["-device", "piix3-usb-uhci"],
["-device", "usb-tablet"],
["-device", "virtio-scsi-pci,id=scsi0"],
["-device", "scsi-hd,bus=scsi0.0,drive=drive0"],
["-device", "virtio-net,netdev=user.0"],
["-vga", "qxl"],
["-device", "virtio-serial-pci"],
["-chardev", "socket,path=/tmp/{{ .Name }}-qga.sock,server,nowait,id=qga0"],
["-device", "virtserialport,chardev=qga0,name=org.qemu.guest_agent.0"],
["-chardev", "spicevmc,id=spicechannel0,name=vdagent"],
["-device", "virtserialport,chardev=spicechannel0,name=com.redhat.spice.0"],
["-spice", "unix,addr=/tmp/{{ .Name }}-spice.socket,disable-ticketing"],
]
boot_wait = "5s"
boot_command = ["<enter>"]
disk_interface = "virtio-scsi"
disk_cache = "unsafe"
disk_discard = "unmap"
disk_size = var.disk_size
floppy_files = [
"windows-11-21h2-uefi/autounattend.xml",
"winrm.ps1",
"provision-powershell.ps1",
"provision-psremoting.ps1",
"provision-openssh.ps1",
"drivers/vioserial/w10/amd64/*.cat",
"drivers/vioserial/w10/amd64/*.inf",
"drivers/vioserial/w10/amd64/*.sys",
"drivers/viostor/w10/amd64/*.cat",
"drivers/viostor/w10/amd64/*.inf",
"drivers/viostor/w10/amd64/*.sys",
"drivers/vioscsi/w10/amd64/*.cat",
"drivers/vioscsi/w10/amd64/*.inf",
"drivers/vioscsi/w10/amd64/*.sys",
"drivers/NetKVM/w10/amd64/*.cat",
"drivers/NetKVM/w10/amd64/*.inf",
"drivers/NetKVM/w10/amd64/*.sys",
"drivers/qxldod/w10/amd64/*.cat",
"drivers/qxldod/w10/amd64/*.inf",
"drivers/qxldod/w10/amd64/*.sys",
]
format = "qcow2"
headless = true
http_directory = "."
iso_url = var.iso_url
iso_checksum = var.iso_checksum
shutdown_command = "shutdown /s /t 0 /f /d p:4:1 /c \"Packer Shutdown\""
communicator = "ssh"
ssh_username = "vagrant"
ssh_password = "vagrant"
ssh_timeout = "4h"
}
source "virtualbox-iso" "windows-11-21h2-uefi-amd64" {
cpus = 2
memory = 4096
disk_size = var.disk_size
cd_files = [
"windows-11-21h2-uefi/autounattend.xml",
"winrm.ps1",
"provision-powershell.ps1",
"provision-psremoting.ps1",
"provision-openssh.ps1",
]
guest_additions_interface = "sata"
guest_additions_mode = "attach"
guest_os_type = "Windows10_64"
hard_drive_interface = "sata"
headless = true
iso_url = var.iso_url
iso_checksum = var.iso_checksum
iso_interface = "sata"
shutdown_command = "shutdown /s /t 0 /f /d p:4:1 /c \"Packer Shutdown\""
vboxmanage = [
["storagectl", "{{ .Name }}", "--name", "IDE Controller", "--remove"],
["modifyvm", "{{ .Name }}", "--firmware", "efi"],
["modifyvm", "{{ .Name }}", "--vrde", "off"],
["modifyvm", "{{ .Name }}", "--graphicscontroller", "vboxsvga"],
["modifyvm", "{{ .Name }}", "--vram", "128"],
["modifyvm", "{{ .Name }}", "--accelerate3d", "on"],
["modifyvm", "{{ .Name }}", "--usb", "on"],
["modifyvm", "{{ .Name }}", "--mouse", "usbtablet"],
["modifyvm", "{{ .Name }}", "--audio", "none"],
["modifyvm", "{{ .Name }}", "--nictype1", "82540EM"],
["modifyvm", "{{ .Name }}", "--nictype2", "82540EM"],
["modifyvm", "{{ .Name }}", "--nictype3", "82540EM"],
["modifyvm", "{{ .Name }}", "--nictype4", "82540EM"],
]
boot_wait = "3s"
boot_command = ["<up><wait><up><wait><up><wait><up><wait><up><wait><up><wait><up><wait><up><wait><up><wait><up><wait>"]
communicator = "ssh"
ssh_username = "vagrant"
ssh_password = "vagrant"
ssh_timeout = "4h"
}
build {
sources = [
"source.qemu.windows-11-21h2-uefi-amd64",
"source.virtualbox-iso.windows-11-21h2-uefi-amd64"
]
provisioner "powershell" {
script = "disable-windows-updates.ps1"
}
provisioner "powershell" {
script = "disable-windows-defender.ps1"
}
provisioner "powershell" {
script = "remove-one-drive.ps1"
}
provisioner "powershell" {
script = "remove-apps.ps1"
}
provisioner "powershell" {
only = ["virtualbox-iso.windows-11-21h2-uefi-amd64"]
script = "virtualbox-prevent-vboxsrv-resolution-delay.ps1"
}
provisioner "powershell" {
only = ["qemu.windows-11-21h2-uefi-amd64"]
script = "provision-guest-tools-qemu-kvm.ps1"
}
provisioner "windows-restart" {
}
provisioner "powershell" {
only = ["qemu.windows-11-21h2-uefi-amd64"]
script = "libvirt-fix-cpu-driver.ps1"
}
provisioner "powershell" {
script = "provision.ps1"
}
provisioner "windows-update" {
}
provisioner "powershell" {
script = "enable-remote-desktop.ps1"
}
provisioner "powershell" {
script = "provision-cloudbase-init.ps1"
}
provisioner "powershell" {
script = "eject-media.ps1"
}
provisioner "powershell" {
script = "optimize.ps1"
}
post-processor "vagrant" {
output = var.vagrant_box
vagrantfile_template = "Vagrantfile-uefi.template"
}
}