-
Notifications
You must be signed in to change notification settings - Fork 2
/
template.json
57 lines (57 loc) · 1.57 KB
/
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
{
"variables": {
"aws_access_key": "",
"aws_secret_key": "",
"rds_host": "",
"rds_password": "",
"build_env": "",
"ami_name": ""
},
"builders": [{
"type": "amazon-ebs",
"access_key": "{{user `aws_access_key`}}",
"secret_key": "{{user `aws_secret_key`}}",
"region": "us-west-2",
"source_ami": "ami-d2c924b2",
"instance_type": "t2.medium",
"ssh_username": "centos",
"ami_name": "{{user `ami_name`}}-{{user `build_env`}} {{timestamp}}",
"ssh_private_ip": false,
"associate_public_ip_address": true,
"ssh_pty" : true,
"security_group_id": "sg-dff3bcb9",
"shutdown_behavior": "terminate"
}],
"provisioners": [{
"type": "file",
"source": "./dist",
"destination": "/tmp"
},{
"type": "shell",
"inline": [
"sleep 30",
"sudo yum -y install at",
"sudo systemctl start atd",
"sudo sh -c \"echo 'Instance shutting down in 10 minutes' | at 'now + 50 minutes'\"",
"sudo sh -c \"echo halt | at 'now + 60 minutes'\""
]
},{
"type": "shell",
"inline": [
"sudo yum -y install epel-release",
"sudo yum -y install ansible git",
"sudo yum clean all"
]
},{
"type": "ansible-local",
"playbook_file": "./deploy/playbook.yml",
"role_paths": [
"./deploy/roles/nodejs",
"./deploy/roles/api",
"./deploy/roles/repo-epel",
"./deploy/roles/logging",
"./deploy/roles/nginx"
],
"extra_arguments": "-vv --extra-vars \"db_host={{user `rds_host`}} db_password={{user `rds_password`}} node_env={{user `build_env`}}\""
}]
}