mirror of https://github.com/status-im/consul.git
68 lines
2.0 KiB
JSON
68 lines
2.0 KiB
JSON
|
{
|
||
|
"min_packer_version": "1.5.4",
|
||
|
"variables": {
|
||
|
"aws_region": "{{env `AWS_DEFAULT_REGION`}}",
|
||
|
"consul_version": "1.5.1",
|
||
|
"download_url": "{{env `CONSUL_DOWNLOAD_URL`}}",
|
||
|
"dd_api_key": "{{env `DD_API_KEY`}}"
|
||
|
},
|
||
|
"builders": [{
|
||
|
"name": "ubuntu18-ami",
|
||
|
"ami_name": "consul-ubuntu-{{isotime | clean_resource_name}}-{{uuid}}",
|
||
|
"ami_description": "An Ubuntu 18.04 AMI that has Consul installed.",
|
||
|
"instance_type": "t2.micro",
|
||
|
"region": "{{user `aws_region`}}",
|
||
|
"associate_public_ip_address": true,
|
||
|
"type": "amazon-ebs",
|
||
|
"source_ami_filter": {
|
||
|
"filters": {
|
||
|
"virtualization-type": "hvm",
|
||
|
"architecture": "x86_64",
|
||
|
"name": "ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server-*",
|
||
|
"block-device-mapping.volume-type": "gp2",
|
||
|
"root-device-type": "ebs"
|
||
|
},
|
||
|
"owners": ["099720109477"],
|
||
|
"most_recent": true
|
||
|
},
|
||
|
"ssh_username": "ubuntu"
|
||
|
}],
|
||
|
"provisioners": [{
|
||
|
"type": "shell",
|
||
|
"inline": ["mkdir -p /home/ubuntu/scripts"]
|
||
|
},{
|
||
|
"type": "file",
|
||
|
"source": "{{template_dir}}/scripts",
|
||
|
"destination": "/home/ubuntu",
|
||
|
"pause_before": "30s"
|
||
|
},{
|
||
|
"type": "shell",
|
||
|
"inline": [
|
||
|
"if test -n \"{{user `download_url`}}\"; then",
|
||
|
"/home/ubuntu/scripts/install-consul --download-url {{user `download_url`}};",
|
||
|
"else",
|
||
|
"/home/ubuntu/scripts/install-consul --version {{user `consul_version`}};",
|
||
|
"fi"
|
||
|
],
|
||
|
"pause_before": "30s"
|
||
|
},{
|
||
|
"type": "shell",
|
||
|
"inline": [
|
||
|
"/home/ubuntu/scripts/setup-systemd-resolved"
|
||
|
],
|
||
|
"pause_before": "30s"
|
||
|
},{
|
||
|
"type": "shell",
|
||
|
"inline": [
|
||
|
"DD_AGENT_MAJOR_VERSION=7 DD_API_KEY={{user `dd_api_key`}} bash -c \"$(curl -L https://raw.githubusercontent.com/DataDog/datadog-agent/master/cmd/agent/install_script.sh)\""
|
||
|
]
|
||
|
},{
|
||
|
"type": "shell",
|
||
|
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'",
|
||
|
"environment_vars": [
|
||
|
"DD_API_KEY={{user `dd_api_key`}}"
|
||
|
],
|
||
|
"script": "{{template_dir}}/scripts/move-files.sh"
|
||
|
}]
|
||
|
}
|