-
Notifications
You must be signed in to change notification settings - Fork 113
/
windows.json
151 lines (151 loc) · 7.5 KB
/
windows.json
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
{
"_comment1": "NAME=windows-10-enterprise-x64-eval WINDOWS_VERSION=10 VIRTIO_WIN_ISO_DIR=./packer_cache/virtio-win ISO_URL=https://software-static.download.prss.microsoft.com/dbazure/988969d5-f34g-4e03-ac9d-1f9786c66750/19045.2006.220908-0225.22h2_release_svc_refresh_CLIENTENTERPRISEEVAL_OEMRET_x64FRE_en-us.iso PACKER_IMAGES_OUTPUT_DIR=/var/tmp/ TMPDIR=/var/tmp/ LOG_DIR=/tmp/ packer build -only=qemu windows.json",
"_comment3": "NAME=windows-server-2016-standard-x64-eval WINDOWS_VERSION=2016 VIRTIO_WIN_ISO_DIR=./packer_cache/virtio-win ISO_URL=https://software-download.microsoft.com/download/pr/Windows_Server_2016_Datacenter_EVAL_en-us_14393_refresh.ISO PACKER_IMAGES_OUTPUT_DIR=/var/tmp/ TMPDIR=/var/tmp/ LOG_DIR=/tmp/ packer build -only=qemu windows.json",
"_comment4": "NAME=windows-server-2019-standard-x64-eval WINDOWS_VERSION=2019 VIRTIO_WIN_ISO_DIR=./packer_cache/virtio-win ISO_URL=https://software-static.download.prss.microsoft.com/dbazure/988969d5-f34g-4e03-ac9d-1f9786c66749/17763.3650.221105-1748.rs5_release_svc_refresh_SERVER_EVAL_x64FRE_en-us.iso PACKER_IMAGES_OUTPUT_DIR=/var/tmp/ TMPDIR=/var/tmp/ LOG_DIR=/tmp/ packer build -only=qemu windows.json",
"_comment5": "NAME=windows-server-2022-standard-x64-eval WINDOWS_VERSION=2022 VIRTIO_WIN_ISO_DIR=./packer_cache/virtio-win ISO_URL=https://software-static.download.prss.microsoft.com/sg/download/888969d5-f34g-4e03-ac9d-1f9786c66749/SERVER_EVAL_x64FRE_en-us.iso PACKER_IMAGES_OUTPUT_DIR=/var/tmp/ TMPDIR=/var/tmp/ LOG_DIR=/tmp/ packer build -only=qemu windows.json",
"builders": [
{
"accelerator": "{{ user `accelerator` }}",
"communicator": "winrm",
"cpus": "{{ user `cpus` }}",
"disk_size": "{{ user `disk_size` }}",
"floppy_files": [
"{{ user `autounattend` }}",
"scripts/win-common/ConfigureRemotingForAnsible.ps1",
"scripts/win-common/fixnetwork.ps1",
"scripts/win-common/unattend.xml",
"scripts/win-common/sysprep.bat"
],
"headless": "{{ user `headless` }}",
"iso_checksum": "file:{{ user `iso_checksum` }}",
"iso_urls": ["{{ user `iso_url` }}"],
"cd_files": ["{{ user `virtio_win_iso_dir` }}"],
"memory": "{{ user `memory` }}",
"output_directory": "{{ user `name` }}-qemu",
"shutdown_command": "A:\\sysprep.bat",
"shutdown_timeout": "15m",
"type": "qemu",
"vm_name": "{{ user `name` }}",
"winrm_insecure": "true",
"winrm_password": "{{ user `winrm_password` }}",
"winrm_timeout": "1h",
"winrm_use_ssl": "true",
"winrm_username": "{{ user `winrm_username` }}"
},
{
"communicator": "winrm",
"cpus": "{{ user `cpus` }}",
"disk_size": "{{ user `disk_size` }}",
"floppy_files": [
"{{ user `autounattend` }}",
"scripts/win-common/ConfigureRemotingForAnsible.ps1",
"scripts/win-common/fixnetwork.ps1",
"scripts/win-common/unattend.xml",
"scripts/win-common/sysprep.bat"
],
"gfx_vram_size": 48,
"guest_additions_mode": "attach",
"guest_os_type": "Windows{{ user `windows_version` }}_64",
"hard_drive_interface": "sata",
"headless": "{{ user `headless` }}",
"iso_checksum": "file:{{ user `iso_checksum` }}",
"iso_urls": ["{{ user `iso_url` }}"],
"memory": "{{ user `memory` }}",
"output_directory": "{{ user `name` }}-virtualbox-iso",
"shutdown_command": "A:\\sysprep.bat",
"shutdown_timeout": "15m",
"type": "virtualbox-iso",
"vboxmanage": [
["modifyvm", "{{ .Name }}", "--graphicscontroller", "vboxsvga"],
["modifyvm", "{{ .Name }}", "--audiocontroller", "ac97"],
[
"modifyvm",
"{{ .Name }}",
"--recordingfile",
"{{ user `packer_templates_logs` }}/{{ user `name` }}-virtualbox.webm"
],
["modifyvm", "{{ .Name }}", "--recordingvideofps", "1"],
["modifyvm", "{{ .Name }}", "--recordingscreens", "0"],
["modifyvm", "{{ .Name }}", "--recording", "on"]
],
"vm_name": "{{ user `name` }}",
"winrm_insecure": "true",
"winrm_password": "{{ user `winrm_password` }}",
"winrm_timeout": "1h",
"winrm_use_ssl": "true",
"winrm_username": "{{ user `winrm_username` }}"
}
],
"post-processors": [
[
{
"compression_level": 9,
"output": "{{ user `packer_images_output_dir` }}/{{ user `name` }}-{{ .Provider }}.box",
"type": "vagrant",
"vagrantfile_template": "Vagrantfile-windows.template"
}
]
],
"provisioners": [
{
"duration": "2m",
"type": "sleep"
},
{
"inline": [
"$cert = (Get-AuthenticodeSignature 'E:\\VBoxWindowsAdditions.exe').SignerCertificate; [System.IO.File]::WriteAllBytes('C:\\vbox.cer', $cert.Export([System.Security.Cryptography.X509Certificates.X509ContentType]::Cert));",
"certutil.exe -f -addstore TrustedPublisher C:\\vbox.cer",
"E:\\VBoxWindowsAdditions.exe /S",
"del C:\\vbox.cer"
],
"only": ["virtualbox-iso"],
"type": "powershell"
},
{
"type": "ansible",
"extra_arguments": [
"-e",
"packer_build_name={{ user `name` }}",
"-e",
"ansible_password='{{ user `winrm_password` }}'",
"-e",
"ansible_winrm_server_cert_validation=ignore",
"-e",
"ansible_winrm_connection_timeout=2000"
],
"user": "{{ user `winrm_username` }}",
"ansible_env_vars": ["ANSIBLE_CONFIG=ansible/ansible.cfg"],
"use_proxy": false,
"playbook_file": "ansible/win-simple.yml"
},
{
"inline": [
"%HOMEDRIVE%\\BleachBit-Portable\\bleachbit_console.exe --clean deepscan.backup deepscan.ds_store deepscan.thumbs_db deepscan.tmp internet_explorer.cache internet_explorer.cookies internet_explorer.downloads internet_explorer.forms internet_explorer.history internet_explorer.logs system.clipboard system.custom system.logs system.memory_dump system.muicache system.prefetch system.recycle_bin system.tmp system.updates windows_defender.backup windows_defender.history windows_defender.logs windows_defender.quarantine windows_defender.temp windows_explorer.mru windows_explorer.recent_documents windows_explorer.run windows_explorer.search_history windows_explorer.shellbags windows_explorer.thumbnails > NUL",
"%HOMEDRIVE%\\ultradefrag-portable-7.1.4.amd64\\udefrag.exe --optimize --repeat --suppress-progress-indicator %SystemDrive%",
"rmdir /s /q %HOMEDRIVE%\\ultradefrag-portable-7.1.4.amd64",
"%HOMEDRIVE%\\BleachBit-Portable\\bleachbit_console.exe --clean system.free_disk_space",
"rmdir /s /q %HOMEDRIVE%\\BleachBit-Portable"
],
"pause_before": "5m",
"remote_path": "C:\\script.bat",
"type": "windows-shell"
}
],
"variables": {
"accelerator": "kvm",
"autounattend": "http/windows-{{ env `WINDOWS_VERSION` }}/Autounattend.xml",
"cpus": "4",
"disk_size": "51200",
"headless": "false",
"iso_checksum": "win_iso.sha256",
"iso_url": "{{ env `ISO_URL` }}",
"memory": "8192",
"name": "{{ env `NAME` }}",
"packer_images_output_dir": "{{ env `PACKER_IMAGES_OUTPUT_DIR` }}",
"packer_templates_logs": "{{ env `LOGDIR` }}",
"virtio_win_iso_dir": "{{ env `VIRTIO_WIN_ISO_DIR` }}",
"windows_version": "{{ env `WINDOWS_VERSION` }}",
"winrm_password": "vagrant",
"winrm_username": "vagrant"
}
}