-
Notifications
You must be signed in to change notification settings - Fork 3
/
template.json
80 lines (78 loc) · 2.35 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
{
"variables": {
"aws_region": "eu-central-1",
"ami_base_name": "",
"aws_access_key" : "{{ env `AWS_ACCESS_KEY_ID` }}",
"aws_secret_key": "{{ env `AWS_SECRET_ACCESS_KEY` }}",
"vpcid" : "<vpcid>",
"subnetid" : "<subnet_id>",
"dockerpassword": "{{env `dockerpassword`}}",
"dockeruser": "{{env `dockeruser`}}"
},
"builders": [{
"access_key": "{{user `aws_access_key`}}",
"secret_key": "{{user `aws_secret_key`}}",
"type": "amazon-ebs",
"ami_name": "packer-example {{timestamp}}",
"ami_description": "An example of how to create a custom AMI on top of Ubuntu",
"instance_type": "t2.micro",
"region": "{{user `aws_region`}}",
"vpc_id": "{{user `vpcid`}}",
"subnet_id": "{{user `subnetid`}}",
"force_delete_snapshot" : "true",
"force_deregister" : "true",
"security_group_id" : "<security_group>",
"associate_public_ip_address": "true",
"tags": {
"Name": "JMeterAMI"
},
"source_ami_filter": {
"filters": {
"virtualization-type": "hvm",
"name": "amzn2-ami-hvm-2.0.????????-x86_64-gp2",
"root-device-type": "ebs"
},
"owners": ["amazon"],
"most_recent": true
},
"ssh_username": "ec2-user"
}
],
"provisioners" : [
{
"type" : "shell",
"script": "Scripts/prepare.sh",
"environment_vars" : [
"dockerpassword={{ user `dockerpassword`}}",
"dockeruser={{user `dockeruser`}}"
]
},
{
"type": "file",
"source" : "ToUpload/",
"destination": "/tmp"
},
{
"type": "shell",
"inline": [
"aws configure set aws_access_key_id {{user `aws_access_key`}}",
"aws configure set aws_secret_access_key {{user `aws_secret_key`}}",
"aws configure set region {{user `aws_region`}}",
"sudo mv /tmp/* /opt/jmeter",
"sudo chmod 777 /opt/jmeter"
]
},
{
"type": "file",
"source" : "./",
"destination": "/tmp"
},
{
"type" : "ansible-local",
"playbook_file" : "test.yml",
"staging_directory" : "/opt/jmeter/roles",
"playbook_dir" : "terraform/roles",
"extra_arguments": [ "--extra-vars \"bucket=jmetertestresult-850526132661 keyprefix=mqtttestresult\"", "--tags prepare" ]
}
]
}