open-nomad/e2e/terraform/packer/packer-windows.json
Tim Gross b23150057a
E2E: move Nomad installation to script on remote hosts (#8706)
This changeset moves the installation of Nomad binaries out of the
provisioning framework and into scripts that are installed on the remote host
during AMI builds.

This provides a few advantages:

* The provisioning framework can be reduced in scope (with the goal of moving
  most of it into the Terraform stack entirely).
* The scripts can be arbitrarily complex if we don't have to stuff them into
  ssh commands, so it's easier to make them idempotent. In this changeset, the
  scripts check the version of the existing binary and don't re-download when
  using the `--nomad_sha` or `--nomad_version` flags.
* The scripts can be OS/distro specific, which helps in building new test
  targets.
2020-08-20 16:10:00 -04:00

77 lines
2.1 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"
]
},
{
"type": "windows-restart"
},
{
"type": "file",
"source": "./windows/install-nomad.ps1",
"destination": "/opt/install-nomad.ps1"
},
{
"type": "powershell",
"elevated_user": "Administrator",
"elevated_password": "{{.WinRMPassword}}",
"inline": ["/opt/install-nomad.ps1 -nomad_version 0.9.6 -nostart"]
},
{
"type": "powershell",
"elevated_user": "Administrator",
"elevated_password": "{{.WinRMPassword}}",
"scripts": [
"windows/install-consul.ps1",
"windows/install-vault.ps1"
]
},
{
"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"
]
}
]
}