diff --git a/dev/packer.json b/dev/packer.json new file mode 100644 index 0000000..f7eb3d0 --- /dev/null +++ b/dev/packer.json @@ -0,0 +1,54 @@ +{ + "variables": { + "aws_access_key": "{{env `AWS_ACCESS_KEY_ID`}}", + "aws_secret_key": "{{env `AWS_SECRET_ACCESS_KEY`}}", + "destination_regions": "eu-west-1,eu-west-2,eu-west-3,eu-central-1,us-east-1,us-west-1,ap-northeast-1,sa-east-1", + "hostname": "misp" + }, + "builders": [{ + "type": "amazon-ebs", + "access_key": "{{user `aws_access_key`}}", + "secret_key": "{{user `aws_secret_key`}}", + "region": "eu-west-1", + "ami_groups": "all", + "source_ami_filter": { + "filters": { + "virtualization-type": "hvm", + "name": "ubuntu/images/*ubuntu-xenial-16.04-amd64-server-*", + "root-device-type": "ebs" + }, + "owners": ["099720109477"], + "most_recent": true + }, + "instance_type": "t2.micro", + "ami_regions": "{{user `destination_regions`}}", + "ssh_username": "ubuntu", + "ami_name": "MISP-{{timestamp}}", + "ami_description": "MISP - Malware Information Sharing Platform", + "tags": { + "Amazon_AMI_Management_Identifier": "misp-build" + } + }], + "provisioners": [ + { + "type": "shell", + "execute_command": "echo '{{user `ssh_pass`}}' | {{ .Vars }} sudo -E -S sh '{{ .Path }}'", + "inline":[ + "echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers" + ] + }, + { + "type": "shell", + "execute_command" : "echo '{{user `ssh_pass`}}' | {{ .Vars }} sudo -E -S sh '{{ .Path }}'", + "script": "/home/ubuntu/misp/bootstrap", + "pause_before": "10s" + } + ], + "post-processors":[{ + "type": "amazon-ami-management", + "regions": "{{user `destination_regions`}}", + "identifier": "misp-build", + "keep_releases": "1" + } + ] +}