I recently wanted to update my Vagrant box running Debian Wheezy. The problem is, the box size is growing on each updates for several reasons. And I prefer to create a new box from scratch on any new Debian release.
Starting from scratch each time is a little bit boring, that’s why I created a preseed file (french). That made the install automatically, however I always had to do other step by hands (or need to write a script for it).
I remembered to have tested Packer a few times ago and decided to look at the features of the latest version.
The last one is good enough to make all I needed. So I started to write a Packer configuration file (on GitHub) and now I can build a Vagrant box ready in a few minutes in only one command!
Do you want to see? First clone the repository:
$ git clone https://github.com/deimosfr/packer-wheezy
Then edit deimosfr_debian-wheezy file and adapt the variables fields with the Debian version you want and the ISO sha512 checksum:
Once done, create your box file:
$ packer build deimosfr_debian-wheezy
That’s it 🙂
You can find the result on the vagrantcloud here if you only want to get the version built with it: https://vagrantcloud.com/deimosfr/debian-wheezy
Thanks HashiCorp for Vagrant and Packer 🙂