I'm trying to use Bento, Veewee and Vagrant to automate the process of provisioning VMs. This approach has a lot of promise for simplifying development, dev-testing and QA processes.
(For those who haven't encountered these -- Vagrant makes it easy to quickly set up / tear down VMs in Virtual Box, VMWare, EC2 etc.; Veewee simplifies the process of building base boxes for Veewee; and Bento simplifies the process of defining base boxes and then automating the operation of Veewee).
The problem is, the interrelationship of Bento, Veewee and Vagrant is confusing. Many definition files, and some operations, are duplicated across layers and it isn't clear which layer should get the updates that're specific to my project. The Ruby environment also complicates this quite a lot -- seems like Bento commands all need to be run from the Bento directory, so boxes & other files end up in illogical places.
Can anyone suggest a file layout & workflow for using this combination of tools?
It sounds like you're wanting to apply Bento, Vagrant, and/or Veewee to provision & perform QA testing on boxes. Thanks to the folks & community behind Chef, a tool already exists to do exactly what you are trying to do!
It's called
test-kitchen
. You can use it with the prebuilt Chef Bento Boxes which OpsCode/Chef maintains and builds with Packer. No need to build Vagrant boxes or VM images from scratch with VeeWee or Packer if you just want to get to Provisioning / Testing.Test Kitchen is a test harness tool to execute provisioning code (in Chef, Ansible, Puppet, SaltStack, or Bash / Powershell via
bootstrap.sh
orbootstrap.ps1
) on one or more platforms in isolation. It uses a driver plugin architecture which lets you plug it into various cloud providers and virtualization technologies such as Amazon EC2, Blue Box, CloudStack, Digital Ocean, Rackspace, OpenStack, Vagrant, Docker, LXC containers, VMWare VSphere, Google Compute Engine, Azure, and many more. There are also "busser" testing plugins which allow pluggable support for multiple testing frameworks including Bats, shUnit2, RSpec, Serverspec, Shpec, Tox, Nose2, MiniTest, Cucumber, AnsibleSpec, with others being created.For Chef, Puppet, and Ansible workflows, cookbook dependency resolver tools such as Berkshelf, Librarian-Chef, Librarian-Puppet, Ansible Galaxy, Librarian-Ansible are supported or you can simply have a
cookbooks/
directory and Test Kitchen will know what to do. If you are already using Chef community cookbooks, Test Kitchen integration tests are already included in many such as the MySQL, nginx, Chef Server, and runit cookbooks.It's pretty flexible and for your use case, you can probably make it do what you want by choosing the right set of gem plugins. Because it came out of the Chef community, you'll probably have the best experience using it with Chef cookbooks, Vagrant driver, and either ServerSpec or Bats testing plugins. However, it is gaining traction as a CI & QA testing tool on it's own with the many community plugins that are available.
If you're interested in seeing what's out there, just search RubyGems for
kitchen-
orbusser-
for more options.If you're new to Ruby, Chef, or all of this in general... an easy way to get started is to install the ChefDK which includes
test-kitchen
,knife
,Berkshelf
and the basic / Chef.io-supported testing tools.Once you have that, and if you're feeling adventurous or want to experiment with alternative pluggable provisioners, drivers, and busser plugins, you can install any of these into the ChefDK Ruby environment (example for Mac OS X / Unix) by using these commands:
If you want to play around with a demo repository that I've created for testing Ansible playbooks / roles, check out Ansible TDD