-
Notifications
You must be signed in to change notification settings - Fork 2
/
custom.windows.template.json
79 lines (76 loc) · 2.9 KB
/
custom.windows.template.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
{
"variables": {
"client_id": "{{env `client_id`}}",
"client_secret": "{{env `client_secret`}}",
"subscription_id": "{{env `subscription_id`}}",
"tenant_id": "{{env `tenant_id`}}",
"object_id": "{{env `object_id`}}",
"resource_group": "{{env `resource_group`}}",
"storage_account": "{{env `storage_account`}}",
"image_publisher": "{{env `image_publisher`}}",
"image_offer": "{{env `image_offer`}}",
"image_sku": "{{env `image_sku`}}",
"location": "{{env `location`}}",
"script_path": "{{env `script_path`}}",
"script_name": "{{env `script_name`}}",
"script_arguments": "{{env `script_arguments`}}",
"package_path": "{{env `package_path`}}",
"package_name": "{{env `package_name`}}",
"capture_name_prefix": "{{env `capture_name_prefix`}}"
},
"builders": [{
"type": "azure-arm",
"client_id": "{{user `client_id`}}",
"client_secret": "{{user `client_secret`}}",
"resource_group_name": "{{user `resource_group`}}",
"storage_account": "{{user `storage_account`}}",
"subscription_id": "{{user `subscription_id`}}",
"tenant_id": "{{user `tenant_id`}}",
"object_id": "{{user `object_id`}}",
"os_type": "Windows",
"image_publisher": "{{user `image_publisher`}}",
"image_offer": "{{user `image_offer`}}",
"image_sku": "{{user `image_sku`}}",
"location": "{{user `location`}}",
"vm_size": "Standard_D3_v2",
"communicator": "winrm",
"winrm_use_ssl": "true",
"winrm_insecure": "true",
"winrm_timeout": "15m",
"winrm_username": "packer",
"capture_container_name": "vsts-buildimagetask",
"capture_name_prefix": "{{user `capture_name_prefix`}}"
}],
"provisioners": [{
"type": "windows-shell",
"inline": [
"cmd /c \"if exist c:\\\\DeployTemp rd /s /q c:\\\\DeployTemp\"",
"cmd /c \"mkdir c:\\\\DeployTemp\""
]
},
{
"type": "file",
"source": "{{user `script_path`}}",
"destination": "c:\\DeployTemp\\{{user `script_name`}}"
},
{
"type": "file",
"source": "{{user `package_path`}}",
"destination": "c:\\DeployTemp\\{{user `package_name`}}"
},
{
"type": "powershell",
"inline": [
"cd \"C:\\DeployTemp\"",
"ls",
"C:\\DeployTemp\\{{user `script_name`}} {{user `script_arguments`}}"
]
},
{
"type": "powershell",
"inline": [
"if( Test-Path $Env:SystemRoot\\windows\\system32\\Sysprep\\unattend.xml ){ rm $Env:SystemRoot\\windows\\system32\\Sysprep\\unattend.xml -Force}",
"& $Env:SystemRoot\\System32\\Sysprep\\Sysprep.exe /oobe /generalize /quit /quiet"
]
}]
}