Have you ever heard of DevOps?… No?
Well, neither have I until a few weeks ago. Let’s have a look at what almighty Wikipedia says about it:
“DevOps (a clipped compound of development and operations) is a set of practices that emphasizes the collaboration and communication of both software developers and other information-technology (IT) professionals while automating the process of software delivery and infrastructure changes. It aims at establishing a culture and environment where building, testing, and releasing software can happen rapidly, frequently, and more reliably”
Honestly this could mean a lot, and from my opinion it’s still quite vague. You could ask ten other people and end up with ten different definitions. I think DevOps can be explained simply as operations working together with engineers to get things done faster in an automated and consecutive way.
I’ll try to give you a practical example of a DevOps process. We are looking for a solution to provide reproducible and lightweight Windows environments for our developers. In fact, the reason they need fresh systems literally every couple of hours is because slow deployment and installation standards are not an option. So what did we do? We created a “blueprint” of the environment which can be quick and easily reproducible by our developers. This is the story of how I fell in love with DevOps:
First of all, I would highly recommend to install chocolatey on your client (https://chocolatey.org). Cmder will be next, it can be installed through chocolatey with an admin command promt:
cinst cmder –y
The associated binaries can be found in C:\tools. Navigate to the path and start cmder with admin rights. Now you are ready to install the main components: VirtualBox, Vagrant and Packer. Do yourself a favor and use chocolatey again:
cinst virtualbox vagrant packer-y
So far, so good. Let’s create a new folder, e.g. “Vagrant” and cd into the directory. We’re going to clone the git repository from Joe Fitzgerald here ( https://github.com/joefitzgerald/packer-windows.git)
mkdir \Vagrant
cd \Vagrant
git clone https://github.com/joefitzgerald/packer-windows.git
Now you can move the “packer.exe” from %programdata%\chocolatey\lib\packer\tools to \vagrant\packer-windows
You are now ready to build the box. Cd into the packer-windows directory and type:
packer build -only virtualbox-iso windows_2012_r2.json
Be patient now. The whole process can take from 3-5 hours! Afterward, you will find a windows_2012_r2_virtualbox.box file which can be used with vagrant.
The box will be automatically configured with:
By default, a MS evaluation ISO is used which is 180 days valid. If you want to use a different ISO, you have to modify the windows_2012_r2.JSON file and change iso_url and iso_checksum:
To figure out the md5 checksum I recommend the “File Checksum and Integrity Verifier utility”. It can be downloaded here:
https://support.microsoft.com/de-de/kb/841290
Use the following syntax:
cd into the fciv.exe directory
fciv.exe –md5 >iso url<
The tool will compute the md5 checksum of the ISO which you have to use in your .json file.
If you don’t have a volume license ISO, you also need to set the Product Key. For that open the answer_files/2012_r2/Autounattend.xml file, search for ProductKey and follow the instructions.
If you are going to configure your VM as a KMS client, you can use the product keys at http://technet.microsoft.com/en-us/library/jj612867.aspx. These are the default values used in the Key element.
Add the created box file to Vagrant. This will also take a short amount of time.
vagrant box add –name windows_2012_r2 windows_2012_r2_virtualbox.box
Vagrant launch
To start the server with vagrant you need a provisioning script with the final provision.
Create a new directory in C:\vagrant (I called mine DSC1)
cd into there
type vagrant init
Edit the created vagrant file and modify it for your needs. You can use this as an example:
Save it
Type: vagrant up
Shortly after, you can connect to the box via vagrant rdp (Username: vagrant, Password vagrant).
Halt the box with “vagrant halt” or destroy it with “vagrant destroy”. A new box can be built again within seconds, just use “vagrant up”.
That’s it! Enjoy your new, reproducible and lightweight windows environment.
Big thanks to Joe for providing this awesome Github repository! Great work.