This repository has been archived by the owner on Aug 18, 2022. It is now read-only.
forked from lox/windows-2016-vmware-packer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hyperv-windows-2016.json
56 lines (56 loc) · 2.08 KB
/
hyperv-windows-2016.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
{
"variables": {
"vm_name": "hyperv-windows-2016",
"hyperv_switchname": "Packer_vSwitch",
"output_directory": "output",
"cpu": "4",
"ram_size": "8192",
"disk_size": "41440",
"iso_url": "http://care.dlservice.microsoft.com/dl/download/1/6/F/16FA20E6-4662-482A-920B-1A45CF5AAE3C/14393.0.160715-1616.RS1_RELEASE_SERVER_EVAL_X64FRE_EN-US.ISO",
"iso_checksum_type": "sha1",
"iso_checksum": "3BB1C60417E9AEB3F4CE0EB02189C0C84A1C6691"
},
"builders": [{
"vm_name": "{{ user `vm_name` }}",
"switch_name":"{{user `hyperv_switchname`}}",
"type": "hyperv-iso",
"communicator": "winrm",
"iso_url": "{{user `iso_url`}}",
"iso_checksum_type": "{{user `iso_checksum_type`}}",
"iso_checksum": "{{user `iso_checksum`}}",
"output_directory": "{{user `output_directory`}}",
"boot_wait": "2m",
"winrm_username": "vagrant",
"winrm_password": "vagrant",
"winrm_timeout": "6h",
"shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"",
"skip_compaction": true,
"ram_size": "{{user `ram_size`}}",
"cpu": "{{user `cpu`}}",
"disk_size": "{{user `disk_size`}}",
"floppy_files": [
"./answer_files/Autounattend.xml",
"./scripts/disable-winrm.ps1",
"./scripts/enable-winrm.ps1",
"./scripts/disable-screensaver.ps1",
"./scripts/win-updates.ps1",
"./scripts/microsoft-updates.bat"
]
}],
"provisioners": [
{
"type": "powershell",
"elevated_user": "vagrant",
"elevated_password": "vagrant",
"scripts": [
"./scripts/install-chocolatey.ps1"
],
"valid_exit_codes": [0, 1641]
},
{
"type": "windows-restart",
"restart_command": "powershell \"& {(Get-WmiObject win32_operatingsystem).LastBootUpTime > C:\\ProgramData\\lastboot.txt; Restart-Computer -force}\"",
"restart_check_command": "powershell -command \"& {if ((get-content C:\\ProgramData\\lastboot.txt) -eq (Get-WmiObject win32_operatingsystem).LastBootUpTime) {Write-Output 'Sleeping for 600 seconds to wait for reboot'; start-sleep 600} else {Write-Output 'Reboot complete'}}\""
}
]
}