· 7 years ago · Apr 22, 2018, 01:34 AM
1==> Builds finished. The artifacts of successful builds are:
2--> : AMIs were created:
3eu-west-2: ami-xxxxxxxx
4
5{
6 "variables": {
7 "aws_access_key": "{{env `AWS_ACCESS_KEY_ID`}}",
8 "aws_secret_key": "{{env `AWS_SECRET_ACCESS_KEY`}}",
9 "ami_base_name": "xxxxxxxxxxxxxxxx"
10 },
11 "builders": [
12 {
13 "name": "{{user `name`}}",
14 "access_key": "{{user `aws_access_key`}}",
15 "secret_key": "{{user `aws_secret_key`}}",
16 "region": "eu-west-2",
17 "source_ami_filter": {
18 "filters": {
19 "virtualization-type": "hvm",
20 "name": "ubuntu/images/*ubuntu-xenial-16.04-amd64-server-*",
21 "root-device-type": "ebs"
22 },
23 "owners": ["099720109477"],
24 "most_recent": true
25 },
26 "instance_type": "t2.micro",
27 "ssh_username": "ubuntu",
28 "ssh_timeout": "10m",
29 "ami_name": "{{user `ami_base_name`}}_{{timestamp}}",
30 "ami_description": "{{user `ami_base_name`}} AMI",
31 "run_tags": {
32 "ami-create": "{{user `ami_base_name`}}"
33 },
34 "tags": {
35 "ami": "{{user `ami_base_name`}}",
36 "owner": "xxxxxxxxxxxxxxx"
37 },
38 "associate_public_ip_address": true,
39 "type": "amazon-ebs"
40 }
41 ],
42 "provisioners": [
43 {
44 "type": "file",
45 "source": "provision.sh",
46 "destination": "/tmp/provision.sh"
47 },
48 {
49 "type": "shell",
50 "execute_command": "echo 'packer' | sudo -S sh -c '{{ .Vars }} {{ .Path }}'",
51 "inline": [
52 "cd /tmp",
53 "chmod +x provision.sh",
54 "./provision.sh"
55 ]
56 }
57 ]
58}
59
60#!/bin/sh
61echo "provisioning..."