Skip to content

Instantly share code, notes, and snippets.

@Ohadbasan
Created October 26, 2017 15:36
Show Gist options
  • Save Ohadbasan/0319f3921e3fa4f21183a13c34fda476 to your computer and use it in GitHub Desktop.
Save Ohadbasan/0319f3921e3fa4f21183a13c34fda476 to your computer and use it in GitHub Desktop.
packer.json
{
"builders": [{
"type": "amazon-ebs",
"access_key": "{{user `aws_access_key`}}",
"secret_key": "{{user `aws_secret_key`}}",
"region": "us-east-1",
"ami_regions" : ["us-east-1"],
"source_ami": "ami-13be557e",
"instance_type": "c4.large",
"ssh_username": "ubuntu",
"ami_virtualization_type": "hvm",
},
{
"type": "googlecompute",
"account_file": "account.json",
"project_id": "xxx-01",
"source_image": "ubuntu-1604-xenial-v20171011",
"zone": "us-central1-a",
"image_name": "img-{{timestamp}}",
"ssh_username": "ubuntu"
}
],
"provisioners": [{
"type": "shell",
"inline": [
"sleep 30",
"sudo apt-add-repository -y ppa:ansible/ansible",
"sudo apt-get update",
"sudo apt-get -y dist-upgrade",
"sudo apt-get install -y unattended-upgrades",
"sudo unattended-upgrades",
"sudo apt-get install -y ansible dmsetup",
"sudo ansible-galaxy install angstwad.docker_ubuntu",
"sudo chown -R ubuntu:ubuntu /home/ubuntu/.ansible",
"sudo reboot",
"sleep 60"
]},
{
"type": "ansible-local",
"playbook_file": "provision_.yml"
},
{
"type":"shell",
"inline": [
"sudo apt-get install -y python-pip aufs-tools software-properties-common ansible python-pycurl linux-image-extra-$(uname -r) apt-transport-https ca-certificates unzip libwww-perl libdatetime-perl ntp htop iotop",
"sudo reboot",
"sleep 60"
]}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment