forked from hashicorp/best-practices
-
Notifications
You must be signed in to change notification settings - Fork 1
/
base.json
96 lines (96 loc) · 3.3 KB
/
base.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
{
"variables": {
"aws_access_key": "{{env `AWS_ACCESS_KEY_ID`}}",
"aws_secret_key": "{{env `AWS_SECRET_ACCESS_KEY`}}",
"atlas_username": "{{env `ATLAS_USERNAME`}}",
"us_east_1_ami": "ami-9a562df2",
"name": "aws-ubuntu-base",
"us_east_1_name": "aws-us-east-1-ubuntu-base",
"ssh_username": "ubuntu",
"scripts_dir": "scripts/ubuntu",
"config_dir": "config",
"dns_listen_addr": "127.0.0.1"
},
"push": {
"name": "{{user `atlas_username`}}/{{user `name`}}",
"base_dir": "../../.",
"include": [
"{{user `scripts_dir`}}/*",
"{{user `scripts_dir`}}/upstart/*",
"{{user `config_dir`}}/*",
"{{user `config_dir`}}/consul/*",
"{{user `config_dir`}}/consul_template/*",
"{{user `config_dir`}}/consul_template/templates/*",
"{{user `config_dir`}}/envconsul/*",
"{{user `config_dir`}}/vault/*",
"{{user `config_dir`}}/vault/policies/*"
],
"vcs": false
},
"builders": [
{
"name": "aws-us-east-1-ubuntu-base",
"type": "amazon-ebs",
"access_key": "{{user `aws_access_key`}}",
"secret_key": "{{user `aws_secret_key`}}",
"region": "us-east-1",
"vpc_id": "",
"subnet_id": "",
"source_ami": "{{user `us_east_1_ami`}}",
"instance_type": "c3.large",
"ssh_username": "{{user `ssh_username`}}",
"ssh_timeout": "10m",
"ami_name": "{{user `us_east_1_name`}} {{timestamp}}",
"ami_description": "{{user `us_east_1_name`}} AMI",
"run_tags": { "ami-create": "{{user `us_east_1_name`}}" },
"tags": { "ami": "{{user `us_east_1_name`}}" },
"ssh_private_ip": false,
"associate_public_ip_address": true
}
],
"provisioners": [
{
"type": "shell",
"execute_command": "echo {{user `ssh_username`}} | {{ .Vars }} sudo -E -S sh '{{ .Path }}'",
"inline": [
"mkdir -p /ops/{{user `scripts_dir`}}",
"chmod a+w /ops/{{user `scripts_dir`}}",
"mkdir -p /ops/{{user `config_dir`}}",
"chmod a+w /ops/{{user `config_dir`}}"
]
},
{
"type": "file",
"source": "{{user `scripts_dir`}}/.",
"destination": "/ops/{{user `scripts_dir`}}"
},
{
"type": "file",
"source": "{{user `config_dir`}}/.",
"destination": "/ops/{{user `config_dir`}}"
},
{
"type": "shell",
"execute_command": "echo {{user `ssh_username`}} | {{ .Vars }} sudo -E -S sh '{{ .Path }}'",
"inline": [
"sh /ops/{{user `scripts_dir`}}/dependencies.sh",
"sh /ops/{{user `scripts_dir`}}/consul.sh {{user `config_dir`}} {{user `scripts_dir`}}",
"sh /ops/{{user `scripts_dir`}}/consul_template.sh {{user `config_dir`}} {{user `scripts_dir`}}",
"sh /ops/{{user `scripts_dir`}}/envconsul.sh {{user `config_dir`}}",
"sh /ops/{{user `scripts_dir`}}/dnsmasq.sh {{user `dns_listen_addr`}}",
"sh /ops/{{user `scripts_dir`}}/cleanup.sh"
]
}
],
"post-processors": [
{
"type": "atlas",
"only": ["aws-us-east-1-ubuntu-base"],
"artifact": "{{user `atlas_username`}}/{{user `us_east_1_name`}}",
"artifact_type": "amazon.image",
"metadata": {
"created_at": "{{timestamp}}"
}
}
]
}