-
Notifications
You must be signed in to change notification settings - Fork 1
/
packer-aws.json
95 lines (94 loc) · 3.54 KB
/
packer-aws.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
{
"builders": [
{
"type": "amazon-ebs",
"ami_name": "dynamics",
"region": "eu-west-2",
"security_group_id": "sg-76484411",
"subnet_id": "subnet-19492c63",
"encrypt_boot": false,
"ami_users": [
"841411968712"
],
"instance_type": "t2.micro",
"user_data_file": "./scripts/SetUpWinRM.ps1",
"communicator": "winrm",
"winrm_username": "Administrator",
"winrm_use_ssl": false,
"winrm_insecure": true,
"winrm_timeout": "60m",
"windows_password_timeout": "60m",
"source_ami_filter": {
"filters": {
"virtualization-type": "hvm",
"name": "Windows_Server-2019-English-Full-Base-*",
"root-device-type": "ebs"
},
"owners": ["amazon"],
"most_recent": "true"
},
"launch_block_device_mappings": [
{
"device_name": "/dev/sda1",
"volume_size": 50,
"volume_type": "gp2",
"delete_on_termination": true
}
],
"ssh_keypair_name": "packer",
"ssh_private_key_file": "/home/ian/.ssh/id_packer"
}
],
"provisioners": [
{
"inline": [
"winrm quickconfig -q",
"winrm set winrm/config/service/Auth @{Basic=\"true\"}",
"winrm set winrm/config/service @{AllowUnencrypted=\"true\"}",
"winrm set winrm/config/winrs @{MaxMemoryPerShellMB=\"1024\"}",
"netsh advfirewall set allprofiles state off"
],
"type": "windows-shell"
},
{
"inline": [
"powercfg /SetActive SCHEME_MIN",
"cmd /c schtasks /CHANGE /TN \"\\Microsoft\\Windows\\Windows Defender\\Windows Defender Cache Maintenance\" /RL LIMITED",
"cmd /c schtasks /CHANGE /TN \"\\Microsoft\\Windows\\Windows Defender\\Windows Defender Cleanup\" /RL LIMITED",
"cmd /c schtasks /CHANGE /TN \"\\Microsoft\\Windows\\Windows Defender\\Windows Defender Scheduled Scan\" /RL LIMITED",
"cmd /c schtasks /CHANGE /TN \"\\Microsoft\\Windows\\Windows Defender\\Windows Defender Verification\" /RL LIMITED",
"Install-WindowsFeature Net-Framework-Core,Windows-Identity-Foundation -IncludeAllSubFeature -source d:/sources/sxs",
"(New-Object System.Net.WebClient).DownloadFile('https://downloads.puppetlabs.com/windows/puppet6/puppet-agent-6.18.0-x64.msi', 'C:/Windows/Temp/puppet.msi')",
"cmd /c start /wait msiexec /qn /i C:\\Windows\\Temp\\puppet.msi /log C:\\Windows\\Temp\\puppet.log",
"mkdir c:\\scripts",
"cp c:\\programdata\\amazon\\ec2-windows\\launch\\sysprep\\unattend.xml c:\\scripts\\unattend.xml"
],
"type": "powershell"
},
{
"destination": "c:\\ProgramData\\PuppetLabs\\puppet\\etc\\hiera.yaml",
"source": "files/hiera.yaml",
"type": "file"
},
{
"destination": "c:\\windows\\temp\\puppet.zip",
"source": "puppet.zip",
"type": "file"
},
{
"scripts": [
"./scripts/puppet-apply.ps1"
],
"type": "powershell"
},
{
"inline": [
"icacls c:\\ProgramData\\Puppetlabs /grant everyone:F /Q /C /T",
"icacls \"c:\\Program Files\\Puppet Labs\" /grant everyone:F /Q /C /T",
"icacls c:\\Scripts /grant everyone:F /Q /C /T",
"c:\\windows\\system32\\sysprep\\sysprep /generalize /quiet /oobe /shutdown /unattend:c:\\scripts\\unattend.xml"
],
"type": "windows-shell"
}
]
}