9d37233eaf
Have Terraform run the target-specific `provision.sh`/`provision.ps1` script rather than the test runner code which needs to be customized for each distro. Use Terraform's detection of variable value changes so that we can re-run the provisioning without having to re-install Nomad on those specific hosts that need it changed. Allow the configuration "profile" (well-known directory) to be set by a Terraform variable. The default configurations are installed during Packer build time, and symlinked into the live configuration directory by the provision script. Detect changes in the file contents so that we only upload custom configuration files that have changed between Terraform runs
75 lines
2 KiB
JSON
75 lines
2 KiB
JSON
{
|
|
"builders": [
|
|
{
|
|
"type": "amazon-ebs",
|
|
"region": "us-east-1",
|
|
"source_ami_filter": {
|
|
"filters": {
|
|
"virtualization-type": "hvm",
|
|
"name": "Windows_Server-2016-English-Full-Base-*",
|
|
"root-device-type": "ebs"
|
|
},
|
|
"owners": [
|
|
"amazon"
|
|
],
|
|
"most_recent": true
|
|
},
|
|
"instance_type": "t2.medium",
|
|
"ami_name": "nomad-e2e-windows-2016-{{timestamp}}",
|
|
"communicator": "winrm",
|
|
"user_data_file": "windows/setupwinrm.ps1",
|
|
"winrm_username": "Administrator",
|
|
"winrm_insecure": true,
|
|
"winrm_use_ssl": true,
|
|
"tags": {
|
|
"OS": "Windows2016"
|
|
}
|
|
}
|
|
],
|
|
"provisioners": [
|
|
{
|
|
"type": "powershell",
|
|
"elevated_user": "Administrator",
|
|
"elevated_password": "{{.WinRMPassword}}",
|
|
"scripts": [
|
|
"windows/disable-windows-updates.ps1",
|
|
"windows/fix-tls.ps1",
|
|
"windows/install-nuget.ps1",
|
|
"windows/install-tools.ps1",
|
|
"windows/install-docker.ps1",
|
|
"windows/setup-directories.ps1",
|
|
"windows/install-openssh.ps1",
|
|
"windows/install-consul.ps1",
|
|
"windows/install-vault.ps1"
|
|
]
|
|
},
|
|
{
|
|
"type": "windows-restart"
|
|
},
|
|
{
|
|
"type": "file",
|
|
"source": "../config",
|
|
"destination": "/opt"
|
|
},
|
|
{
|
|
"type": "file",
|
|
"source": "./windows/provision.ps1",
|
|
"destination": "/opt/provision.ps1"
|
|
},
|
|
{
|
|
"type": "powershell",
|
|
"elevated_user": "Administrator",
|
|
"elevated_password": "{{.WinRMPassword}}",
|
|
"inline": ["/opt/provision.ps1 -nomad_version 0.9.6 -nostart"]
|
|
},
|
|
{
|
|
"type": "powershell",
|
|
"inline": [
|
|
"C:\\ProgramData\\Amazon\\EC2-Windows\\Launch\\Scripts\\SendWindowsIsReady.ps1 -Schedule",
|
|
"C:\\ProgramData\\Amazon\\EC2-Windows\\Launch\\Scripts\\InitializeInstance.ps1 -Schedule",
|
|
"C:\\ProgramData\\Amazon\\EC2-Windows\\Launch\\Scripts\\SysprepInstance.ps1 -NoShutdown"
|
|
]
|
|
}
|
|
]
|
|
}
|