Skip to content

Instantly share code, notes, and snippets.

@MatthewJDavis
Created August 5, 2018 21:42
Show Gist options
  • Select an option

  • Save MatthewJDavis/e2bb26bb7a90265e292d18250d231fa7 to your computer and use it in GitHub Desktop.

Select an option

Save MatthewJDavis/e2bb26bb7a90265e292d18250d231fa7 to your computer and use it in GitHub Desktop.
Packer build to use the latest version of Windows 1803 to build a lightweight DNS server.
{
"builders": [
{
"type": "amazon-ebs",
"region": "eu-west-1",
"instance_type": "t2.micro",
"ami_name": "1803-dns-{{timestamp}}",
"communicator": "winrm",
"winrm_username": "Administrator",
"winrm_use_ssl": true,
"tags": {
"Name": "1803-dns-{{timestamp}}",
"OS_Version": "Windows-Server-1803",
"Release": "Latest",
"Base_AMI_Name": "{{ .SourceAMIName }}"
},
"source_ami_filter": {
"filters": {
"virtualization-type": "hvm",
"name": "Windows_Server-1803-English-Core-Base*",
"root-device-type": "ebs"
},
"owners": ["801119661308"],
"most_recent": true
},
"user_data_file": "packer-win-user-data.ps1"
}
],
"provisioners": [
{
"type": "powershell",
"inline": [
"Set-Timezone -Id 'GMT Standard Time'",
"Install-WindowsFeature DNS -IncludeManagementTools",
"Set-DnsServerForwarder -IPAddress 10.100.0.2, 1.1.1.1, 8.8.8.8 -Timeout 1 -UseRootHint $false -PassThru",
"Set-DnsServerCache -MaxTtl 0x0",
"Add-DnsServerStubZone -Name 'example.com' -MasterServers 10.200.0.2, 10.200.1.2, 10.200.2.2"
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment