Friday, November 20, 2015

On Learning Vagrant

tl;dr I wanted to learn Vagrant so I would know what Packer does and what Tim's templates and Joe's and Rich's scripts are really doing to improve the process of working with many virtual machines. Along the way I learned to make a catalog of OS X versions for Vagrant allowing me to spin up OS X VMs of any version at will and I will show you how to do that too.

This post will begin a series of articles on using Vagrant to quickly and easily create OS X based virtual machines.

I was first introduced to Vagrant in 2013 by either one (or both!) of Gary Larizza's or Graham Gilbert's posts. I remember thinking it was kinda cool but not really something I needed to put into use (also they were both advocating tools that help with Vagrant but I still didn't know Vagrant). I have access to between 4-8 machines on a daily basis for testing purposes and at the time my portable was a MacBook Air and my iMac still had spinning rust. Not ideal for VMs compared to the i7 with SSD and 16Gigs of RAM I have now.

Fast forward to PSU 2015, both Joseph Chilcote and Rich Trouton are doing presentations on using virtual machines for testing etc. This Vagrantfile Joe showed during the demo that spit out a list of available updates particularly caught my interest because I had gone through the process of updating AutoDMG's UpdateProfiles.plist for new items in the past.

Once I arrived back home I briefly played with vfuse and several other scripts etc. for speedily creating VMs. I didn't really understand what was happening with Packer, Tim's templates or any of that but I managed to find a fix a few problems I was having with some quick Google searches. Somewhat frustrated I put Vagrant away. I was still using the low powered Air and I had to get ready for the start of school. "This won't help me do anything now."

IT work in a school district, in my experience, is pretty cyclical in nature. There are some rough spots at the start and end of the school year and there is a bit of a slowdown in winter. This slowdown is great for research, development, planning, and experimentation. This year I've been feeling things wind down for two weeks or so, and finally at the end of last week I started putting a plan together.

Ultimately I want to get several things going here; Imagr, BSDPy, osquery with logging, and some tweaks to munki and munki-enroll. I knew that one way to get these things going more quickly was Docker and I also knew that a quick way to learn Docker would be to spin up Linux VMs. This is where Vagrant comes back into the picture.

The Vagrant documentation is pretty amazing and I tore into it. I studied it and took notes (physical ones, with a pen). I created some Linux boxes from scratch and I played around. I wanted to create some OS X base boxes for myself as well. I googled and found nothing on creating an OS X base box from scratch (until clicking links further down the results page while creating this post :/ ). I wanted to create some base boxes by hand in Vagrant before learning how Packer improves that process, before learning what Tim's templates do for me so, ultimately, I would know why vfuse + AutoDMG makes that even better.

On the way I learned something pretty cool. Namely that you can create your own catalog of Vagrant base boxes allowing you to spin up, in moments, OS X virtual machines for any OS version you have an installer app for.

The next few posts will show you how to do that too.

No comments:

Post a Comment