Joel Bastos bio photo

Joel Bastos

Automation engineer with a keen interest on devops culture, geek by definition and curious by nature

Email Twitter LinkedIn Github

In a world where the Operating System (OS) installation is almost a thing of the past, with all the hosting providers giving you base boxes to use, some of us still have the privilege to tackle this task.

automation_cloud

Don’t get me wrong, OS installation is not a lost art and it’s vital as the underlying corner stone of an infrastructure.

How would you guarantee important OS security/service upgrade in production will play nice with your application?

How would you be certain the development environment Virtual Machines (VMs) are a match to the production ones?

These questions are easily answered when using the OS as an artefact of the delivery pipeline, just like the application running on it.
But for that you’ll need consistent, versioned and automated way of creating VMs…

Meet Veewee and Packer!

Remember when you first start using kickstart files, first on floppies, then USB pens and finally using the HTTP method?

Remember trying to find a Web Server to share the kickstart file to the soon to be installed box, then using thepython -m SimpleHTTPServer and feeling like a hacker?

Well, this is the next step on the evolution and, as I was living under a rock regarding all things related to base VM build automation, I just started yesterday playing around with these awesome tools (yeah… it was a rainy weekend).

The plan was

  • Build a minimal Centos 6.6 x86_64 VirtualBox VM
  • Use my own kickstart files
  • Import into Vagrant and use it as a base box
  • Get all the configs on version control
  • Guarantee it’s a fully automated process
  • Lean back and enjoy the show
    • Grab some popcorn while it builds
  • Give Veewee and Packer a decent test-drive


So, the next steps were taken to achieve the above requirements (popcorn not included).


Veewee

RTFM

Get it

gem install veewee

Grab an example

git clone https://github.com/kintoandar/veewee.git definitions

Use it

# validate config
veewee vbox validate 'centos-6.6-x86_64'

# start build process
veewee vbox build 'centos-6.6-x86_64'

Share it

veewee vbox export 'centos-6.6-x86_64'

Import it

vagrant box add 'centos-6.6-x86_64' './centos-6.6-x86_64.box'
vagrant init 'centos-6.6-x86_64'
vagrant up
vagrant ssh

Watch the magic happen



Packer

RTFM

Get it

brew tap homebrew/binary
brew install packer

Migrating from Veewee?

# AKA was too lazy to build a packer template
gem install veewee-to-packer

Grab an example

git clone https://github.com/kintoandar/packer.git

Use it

cd packer/centos-6.6-x86_64
packer validate template.json
packer build template.json

Import it

vagrant box add 'centos-6.6-x86_64' './centos-6.6-x86_64.box'
vagrant init 'centos-6.6-x86_64'
vagrant up
vagrant ssh

Watch the magic happen




That’s all folks!

And this is how, in a couple of hours, I’ve became a fan of Veewee and Packer, #truestory.