Skip to content

Instantly share code, notes, and snippets.

@davidfic
Created April 1, 2016 15:57
Show Gist options
  • Save davidfic/dd16836a5ec406473ea29698e6b3021f to your computer and use it in GitHub Desktop.
Save davidfic/dd16836a5ec406473ea29698e6b3021f to your computer and use it in GitHub Desktop.
{
"variables": {
"aws_access_key": "",
"aws_secret_key": "",
"region": "",
"vpc_id": "",
"subnet_id": "",
"security_group_ids": "",
"source_ami": "",
"ssh_username": "",
"instance_type": "",
"iam_instance_profile": "",
"packer_profile": "packer"
},
"builders": [{
"type": "amazon-ebs",
"access_key": "{{user `aws_access_key`}}",
"secret_key": "{{user `aws_secret_key`}}",
"region": "{{user `region`}}",
"source_ami": "{{user `source_ami`}}",
"instance_type": "{{user `instance_type`}}",
"ssh_username": "{{user `ssh_username`}}",
"ami_name": "Foundation Image {{timestamp}}",
"vpc_id": "{{user `vpc_id`}}",
"iam_instance_profile": "{{user `packer_profile`}}",
"security_group_ids": ["{{user `security_group_ids`}}"],
"subnet_id": "{{user `subnet_id`}}",
"tags": {"name": "Foundation Image"}
}],
"provisioners": [
{
"type": "shell",
"execute_command": "echo 'packer' | {{ .Vars }} sudo -E -S sh '{{ .Path }}'",
"inline": [
"apt-get install -y software-properties-common",
"apt-add-repository ppa:ansible/ansible -y",
"/usr/bin/apt-get update",
"/usr/bin/apt-get -y install ansible"
]
},
{
"type": "ansible-local",
"playbook_file": "foundation-playbook.yml",
"inventory_file": "hosts"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment