I’ve spent quite a bit of time trying to create a vagrant image using Matt Wrock’s excellent blog as a resource, and haven’t quite gotten it there yet. Plus, if I go the vagrant route, people have to have powerful machines on which to run test kitchen. The more I worked through that option, the more I because discouraged and dismayed that this may just never work for us.
And then I discovered azure.
Don’t get me wrong: I’m not a Microsoft fanboy. But there are some great advantages to going this route:
- Through my Microsoft-friendly workplace I get a MSDN Subscription, with which I get $50/month credit to use azure. So this is free, and I can run test kitchen on not-my compute resources.
- Microsoft by definition is going to get Windows images right. So I don’t have to fight it anymore. I can just use it. It just works, just like it should.
- Stuart Preston wrote a plugin that gets anyone past the learning curve very quickly. With this plugin you don’t have to really know anything about azure to use it for test kitchen
These reasons are so compelling, this is what our teams will be going with in the coming months. It’s critical that everyone be able to run test kitchen easily, and azure gives us the best shot at doing that without a lot of drama.
Setting up was easy:
- Activate your subscription from your MSDN account
- Install the Azure CLI for Windows
- Follow the directions on the kitchen-azurerm main page to set up a Security Principal, Tenant, Password, and configure it in your user directory
- In a simple cookbook, create a simple kitchen.yml file like this:
--- driver: name: azurerm driver_config: subscription_id: <%= ENV['AZURE_SUBSCRIPTION_ID'] %> location: 'South Central US' machine_size: 'Standard_D1' provisioner: name: chef_zero verifier: name: inspec platforms: - name: windows2012-r2 driver_config: image_urn: MicrosoftWindowsServer:WindowsServer:2012-R2-Datacenter:latest transport: name: winrm - name: centos71 driver_config: image_urn: OpenLogic:CentOS:7.1:latest suites: - name: default run_list: - recipe[contributors::default] attributes:
It’s really that simple. Now I can run test kitchen commands:
|kitchen create||creates azure infrastructure for running, powers on machines|
|kitchen converge||does kitchen create if needed, will converge the node using Chef|
|kitchen verify||does create and converge if needed, runs the tests that you’ve written|
|kitchen test||does everything: create, converge, verify|
|kitchen destroy||don’t forget this one; it removes the resources|
There you have it, go through those easy steps, and you have Kitchen working with Azure.