diff --git a/packer-demo/example.json b/packer-demo/example.json new file mode 100644 index 0000000..b7e2acb --- /dev/null +++ b/packer-demo/example.json @@ -0,0 +1,22 @@ +{ + "variables": { + "aws_access_key": "", + "aws_secret_key": "" + }, + "builders": [{ + "type": "amazon-ebs", + "access_key": "{{user `aws_access_key`}}", + "secret_key": "{{user `aws_secret_key`}}", + "region": "eu-west-1", + "source_ami": "ami-844e0bf7", + "instance_type": "t2.micro", + "ssh_username": "ubuntu", + "ami_name": "packer-example {{timestamp}}" + }], + "provisioners": [{ + "type": "shell", + "scripts": [ "scripts/install_software.sh" ], + "execute_command": "{{ .Vars }} sudo -E sh '{{ .Path }}'", + "pause_before": "10s" + }] +} diff --git a/packer-demo/scripts/install_software.sh b/packer-demo/scripts/install_software.sh new file mode 100644 index 0000000..41537ff --- /dev/null +++ b/packer-demo/scripts/install_software.sh @@ -0,0 +1,3 @@ +#!/bin/bash +apt-get update +apt-get install -y nginx docker.io vim lvm2