The goal of these packer builds is to create consistent Vagrant boxes across multiple vagrant providers, specifically for Chef vagrant usage. Currently only Virtualbox and EC2 are supported.
These setups are typically for the purposes of internal testing and demonstration purposes and don't necessarily reflect recommended production settings.
Required Software:
- Packer 0.5.1+: http://packer.io
- Vagrant: http://vagrantup.com
And one or all of the following for the associated box types to get created:
- AWS account with standard access credentials: http://aws.amazon.com (optional)
- Virtualbox http://virtualbox.org (optional)
Put your access and secret keys in environment variables in your .bashrc or similar (for packer):
export AWS_ACCESS_KEY_ID=YOUR_ACCESS_KEY
export AWS_SECRET_ACCESS_KEY=THE_ASSOCIATED_SECRET_KEY
Currently only CentOS 6 is up to date. Ubuntu and other Linux types are feasible with Packer.
- Modify centos6.json as desired
- Source AMI
- Region
Current images are cloned from the Bashton images: http://www.bashton.com/blog/2013/centos-6-4-ami-available/
This will add boxes for each of the providers packer builds a box for. You can optionally just build a box for specific provider like this:
packer build --only=amazon-ebs centos-x86_64.json
Once you are done building boxes, they will be located in the 'boxes' subdir. You can manually load them using 'vagrant box add' or use the 'load_boxes.sh' to add all boxes and replace any that may already be in Vagrant.
- These boxes assume Vagrant is logging in with 'root', not 'vagrant'.
- These boxes should be updated to the latest package releases on build
- An extra device or logical volume is available (and possibly setup) for /var/lib/mysql (note: for AWS you can configure these at the vagrant-aws level now, so we will leave this unset for EC2 instances)
The VM-based builds use a netinstall ISO and a kickstart file to provision the box. This guarantees all packages are up to date at the time of the build.
AWS uses an official CentOS 6 AMI "with Updates". http://wiki.centos.org/Cloud/AWS These are Region-specific, so you'll need a different AMI identifier for different AWS regions.
Needs work
Local VM -- a favorite for conference tutorials.
Creates an EBS-based AMI associated with a specific AWS Region.
The current instance comes with no extra EBS volumes because these can be added at the Vagrant level. However, you can create AMIs with the EBS volumes pre-defined. An example of such a configuratuion creating a 100GB volume with 1000 provisioned IOPS:
"ami_block_device_mappings": [
{
"device_name": "/dev/sda",
"delete_on_termination": true
},
{
"device_name": "/dev/sdf",
"virtual_name": "mysql_data",
"volume_size": 100,
"volume_type": "io1",
"iops": 1000,
"delete_on_termination": true
}
]
Packer will cruft up your EC2 dashboard. In particular, pay attention and periodically delete:
- Old AMIs
- Unused EBS volumes left over from AMI creation