Skip to content

Instantly share code, notes, and snippets.

@pporada-gl
Created February 18, 2017 22:57
Show Gist options
  • Save pporada-gl/b88253a4f4356475f78524f2190ac0d8 to your computer and use it in GitHub Desktop.
Save pporada-gl/b88253a4f4356475f78524f2190ac0d8 to your computer and use it in GitHub Desktop.
{
"builders": [
{
"access_key": "{{user `var_aws_access_key`}}",
"ami_description": "Built from the GL cut CentOS7. This is a fairly standard CentOS7 image.",
"ami_name": "CentOS 7 x86_64 Base {{timestamp}}",
"associate_public_ip_address": true,
"enhanced_networking": true,
"instance_type": "{{user `var_aws_instance_type`}}",
"region": "{{user `var_aws_region`}}",
"secret_key": "{{user `var_aws_secret_key`}}",
"source_ami": "{{user `var_aws_source_ami`}}",
"ssh_private_ip": false,
"ssh_pty": true,
"ssh_username": "{{user `var_ssh_username`}}",
"subnet_id": "{{user `var_aws_subnet_id`}}",
"tags": {
"Built": "{{isotime \"01-02-2006\"}}",
"Name": "{{user `var_atlas_buildname`}}",
"OS_Family": "RedHat",
"OS_Version": "CentOS",
"Release": "7",
"TestStatus": "untested"
},
"type": "amazon-ebs",
"vpc_id": "{{user `var_aws_vpc_id`}}"
}
],
"description": "{{ami_description}}",
"min_packer_version": "0.10.2",
"post-processors": [
{
"artifact": "{{user `var_atlas_username`}}/{{user `var_atlas_buildname`}}",
"artifact_type": "amazon.image",
"metadata": {
"created_at": "{{timestamp}}"
},
"only": [
"amazon-ebs"
],
"token": "{{user `var_atlas_token`}}",
"type": "atlas"
}
],
"provisioners": [
{
"inline": [
"while [ ! -f /var/lib/cloud/instance/boot-finished ]; do echo 'Waiting for cloud-init...'; sleep 1; done"
],
"type": "shell"
},
{
"execute_command": "sudo -E -S sh '{{ .Path }}'",
"scripts": [
"scripts/packer_sucks_pt1.sh",
"scripts/packer_sucks_pt2.sh",
"scripts/configure_system.sh",
"scripts/configure_ssh.sh"
],
"type": "shell",
"only": ["ec2"]
},
{
"execute_command": "sudo -E -S sh '{{ .Path }}'",
"scripts": [
"scripts/packer_sucks_pt1.sh",
"scripts/packer_sucks_pt2.sh",
"scripts/configure_system.sh",
"scripts/configure_ssh.sh"
],
"type": "shell",
"only": ["openstack"]
}
],
"push": {
"name": "{{user `var_atlas_username`}}/{{user `var_atlas_buildname`}}",
"vcs": false
},
"variables": {
"var_atlas_buildname": "packer-centos7-base",
"var_atlas_token": "{{env `ATLAS_TOKEN`}}",
"var_atlas_username": "{{env `ATLAS_USERNAME`}}",
"var_aws_access_key": "{{env `AWS_ACCESS_KEY_ID`}}",
"var_aws_instance_type": "t2.micro",
"var_aws_region": "us-east-1",
"var_aws_secret_key": "{{env `AWS_SECRET_ACCESS_KEY`}}",
"var_aws_source_ami": "ami-AAAAA",
"var_aws_subnet_id": "subnet-YYYYYY",
"var_aws_vpc_id": "vpc-XXXXX",
"var_ssh_username": "MYUSER
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment