Using Vagrant to Test Puppet ModulesVagrant is a pretty neat tool which allows a developer to easily destroy and create virtual machines in an automated fashion. The puppet provision works great in a standalone fashion but most puppet developers use modules. This post goes over a quick way to test your modules which may help improve your module development.
Clone the module you would like and make sure its named the same as the module name.
git clone <url of module> <module name>
Create a new file at <module name>/Vagrantfile and add the following content.
# -*- mode: ruby -*-Finally, enter the module name directory and run vagrant up.
# vi: set ft=ruby :
Vagrant::Config.run do |config|
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.host_name = "test"
config.vm.provision :puppet do |puppet|
puppet.module_path = ".."
puppet.manifests_path = "tests"
puppet.manifest_file = "init.pp"
This example uses the test/init.pp as the manifest to run and gets modules from the local directory. (if any other modules are available then they can be used in the test as well.)
Hope this small example helps out thoose in the early stages of learning puppet and Vagrant.