· 6 years ago · Mar 17, 2019, 08:58 AM
1{
2 "variables": {
3 "azure_client_secret": "{{env `AZURE_CLIENT_SECRET`}}",
4 "aws_access_key": "{{env `AWS_ACCESS_KEY`}}",
5 "aws_secret_key": "{{env `AWS_SECRET_KEY`}}",
6 "datadog_api_key": "{{env `DATADOG_API_KEY`}}"
7 },
8
9 "builders": [
10 {
11 "type": "amazon-ebs",
12 "ami_name": "nodejs {{timestamp}}",
13 "ami_description": "Ubuntu 16.04, nginx 1.10.3, Node.js 8.x LTS",
14 "access_key": "{{user `aws_access_key`}}",
15 "secret_key": "{{user `aws_secret_key`}}",
16 "region": "{{user `aws_region`}}",
17 "source_ami": "ami-08660f1c6fb6b01e7",
18 "instance_type": "m3.medium",
19 "ssh_username": "ubuntu",
20 "launch_block_device_mappings": [{
21 "delete_on_termination": true,
22 "device_name": "/dev/xvdf",
23 "encrypted": false,
24 "volume_size": 50,
25 "volume_type": "gp2"
26 }]
27 },
28 {
29 "type": "azure-arm",
30 "client_id": "{{ user `client_id`}}",
31 "client_secret": "{{user `azure_client_secret`}}",
32 "managed_image_name": "node-{{timestamp}}",
33 "managed_image_resource_group_name": "{{ user `resource_group_name` }}",
34 "build_resource_group_name": "{{ user `resource_group_name` }}",
35 "subscription_id": "{{ user `subscription_id` }}",
36 "tenant_id": "{{ user `tenant_id` }}",
37 "os_type": "Linux",
38 "image_publisher": "Canonical",
39 "image_offer": "UbuntuServer",
40 "image_sku": "16.04-LTS",
41 "vm_size": "Standard_A2_V2",
42 "os_disk_size_gb": "30",
43 "disk_additional_size": ["50"],
44 "azure_tags": {
45 "type": "node",
46 "createdBy": "packer"
47 }
48 }
49],
50 "provisioners": [
51 {
52 "type": "shell",
53 "script": "setup/_common.sh",
54 "environment_vars": ["DATADOG_API_KEY={{ user `datadog_api_key` }}"]
55 },
56 {
57 "type": "shell",
58 "script": "setup/aws.sh",
59 "only": ["amazon-ebs"]
60 },
61 {
62 "type": "shell",
63 "script": "setup/azure.sh",
64 "only": ["azure-arm"]
65 },
66 {
67 "type": "shell",
68 "script": "post/_common.sh"
69 },
70 {
71 "type": "shell",
72 "script": "post/azure.sh",
73 "only": ["azure-arm"]
74 }
75 ],
76 "post-processors": [
77 {
78 "type": "manifest",
79 "output": "manifest.json",
80 "strip_path": true
81 }
82 ]
83}