-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadvanced_template.json
62 lines (62 loc) · 1.88 KB
/
advanced_template.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
{
"description": "Demo Packer template",
"variables": {
"aws_access_key": "",
"aws_secret_key": "",
"base_ami": "ami-b520c0d8",
"base_docker_image": "ubuntu:16.04",
"instance_type": "t2.medium",
"vpc_id": "vpc-12345678",
"subnet_id": "subnet-87654321"
},
"builders": [
{
"type": "amazon-ebs",
"access_key": "{{user `aws_access_key`}}",
"secret_key": "{{user `aws_secret_key`}}",
"region": "us-east-1",
"source_ami": "{{user `base_ami`}}",
"instance_type": "{{user `instance_type`}}",
"vpc_id": "{{user `vpc_id`}}",
"subnet_id": "{{user `subnet_id`}}",
"associate_public_ip_address": true,
"ssh_username": "ubuntu",
"ami_name": "Packer-build DEMO {{timestamp}}",
"ami_description": "Build at {{isotime \"Mon, 02 Jan 2006 15:04:05 MST\"}} based on {{user `base_ami`}}"
},
{
"type": "docker",
"image": "{{user `base_docker_image`}}",
"pull": true,
"commit": true,
"run_command": ["-d", "-i", "--net=host", "-t", "{{.Image}}", "/bin/bash"]
}
],
"provisioners": [
{
"type": "shell",
"script": "bootstrap.sh",
"only": ["docker"]
},
{
"type": "shell",
"script": "bootstrap.sh",
"execute_command": "{{ .Vars }} sudo -E sh '{{ .Path }}'",
"only": ["amazon-ebs"]
},
{
"type": "shell",
"script": "cleanup.sh"
}
],
"post-processors": [
[
{
"type": "docker-tag",
"only": ["docker"],
"repository": "demo/awsadvent",
"tag": "{{timestamp}}"
}
]
]
}