-
Notifications
You must be signed in to change notification settings - Fork 750
/
packer.json
62 lines (61 loc) · 2.05 KB
/
packer.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
{
"_comment" : "Create a AWS AMI ith AMZ Linux 2018 with Java and Tomcat",
"variables": {
"aws_access_key": "",
"aws_secret_key": "",
"region": "",
"source_ami":"",
"instance_type":"",
"vpc_id": "",
"subnet_id": ""
},
"_comment1" : "packer build -var \"aws_secret_key=foo\" template.json",
"_comment2" : "packer build -var-file packer-vars.json template.json",
"builders": [{
"access_key": "{{user `aws_access_key`}}",
"secret_key": "{{user `aws_secret_key`}}",
"type": "amazon-ebs",
"region": "{{user `region`}}",
"source_ami": "{{user `source_ami`}}",
"instance_type": "{{user `instance_type`}}",
"ssh_username": "ubuntu",
"ami_name": "DevOpsClass-B18-Build-{{isotime | clean_resource_name}}",
"vpc_id": "{{user `vpc_id`}}",
"subnet_id": "{{user `subnet_id`}}",
"tags": {
"Name": "DevOpsClass-B18-Build-{{isotime | clean_resource_name}}"
}
}],
"provisioners": [{
"type": "shell",
"inline": [
"sleep 30",
"sudo apt update -y",
"sudo apt install nginx -y",
"sudo apt install git -y",
"sudo git clone https://github.com/mavrick202/webhooktesting.git",
"sudo rm -rf /var/www/html/index.nginx-debian.html",
"sudo cp webhooktesting/index.html /var/www/html/index.nginx-debian.html",
"sudo cp webhooktesting/style.css /var/www/html/style.css",
"sudo cp webhooktesting/scorekeeper.js /var/www/html/scorekeeper.js",
"sudo service nginx start",
"sudo systemctl enable nginx",
"curl https://get.docker.com | bash"
]
},
{
"type": "file",
"source": "docker.service",
"destination": "/tmp/docker.service"
},
{
"type": "shell",
"inline": [
"sudo cp /tmp/docker.service /lib/systemd/system/docker.service",
"sudo usermod -a -G docker ubuntu",
"sudo systemctl daemon-reload",
"sudo service docker restart"
]
}
]
}