tree: 1243e9b17d5328c0299263306209b594b23756bb [path history] [tgz]
  1. src/
  2. bnd.bnd
  3. pom.xml

Vagrant provider for jclouds


  • git clone
  • cd jclouds-labs/vagrant
  • mvn clean install
  • Copy target/vagrant-2.0.0-SNAPSHOT.jar to your classpath

Local caching proxy


Use polipo for caching proxy. On OS X install with

brew install polipo

From SO:

  • Create a config file at ~/.polipo/config
# logLevel = 0xFF
diskCacheRoot = "~/.polipo/cache/"

  • As root create the file /Library/LaunchDaemons/fr.jussieu.pps.polipo.plist, replace $USER with your username:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
  • sudo chown root:wheel /Library/LaunchDaemons/fr.jussieu.pps.polipo.plist
  • sudo chmod 755 /Library/LaunchDaemons/fr.jussieu.pps.polipo.plist
  • sudo launchctl load -w /Library/LaunchDaemons/fr.jussieu.pps.polipo.plist


  • vagrant plugin install vagrant-proxyconf
  • add to ~/.vagrant.d/Vagrantfile:
Vagrant.configure("2") do |config|
  if Vagrant.has_plugin?("vagrant-proxyconf")
    config.proxy.http     = ""
    config.proxy.https    = ""
    config.proxy.no_proxy = "localhost,"

Where is the IP of your host as seen from the vagrant machines (in this case the NAT interface). Optionally could add all your private network IPs from your Vagrant subnet to no_proxy to skip the proxy for inter-VM communications.


vagrant box add ubuntu/xenial64
vagrant box add ubuntu/trusty64
# Refer to the "Windows boxes" section below on how to create the "boxcutter/eval-win7x86-enterprise" image (optional)
mvn clean install -Plive

Windows boxes

The easiest way to create a Windows Vagrant test image is using the boxcutter-windows packer templates.

brew install packer # or the corresponding alternative for your distribution
git clone boxcutter-windows
cd boxcutter-windows
make virtualbox/eval-win2012r2-standard
vagrant box add boxcutter/eval-win2012r2-standard ./box/virtualbox/

Vagrant providers

jclouds supports the virtualbox an libvirt providers out of the box. To use additional providers users need to let jclouds know how to configure them. For example how to turn configuration like number of cpus or amount of memory to the provider specific configuration. Additional configuration might be needed as well. This is not required, but not providing it will lead to VMs which ignore configuration passed in from jclouds.

To let jclouds configure additional providers create a Ruby file in ~/.jclouds/vagrant/providers. In the file register a block to do the configuration, by calling into CustomProviders.register. The block will be passed two arguments - config which is the Vagrant provided machine config and machine_config which is the configuration coming from jclouds. Here's an example file for libvirt.

CustomProviders.register do |config, machine_config|
  config.vm.provider "libvirt" do |v|
    v.memory = machine_config["memory"] if machine_config.key?("memory")
    v.cpus = machine_config["cpus"] if machine_config.key?("cpus")

jclouds selects the provider to use based on the selected box. Each box lists the provider it's been created for. The current implementation supports just a single provider per box name.

Cleaning up

Sometimes users (or tests) do not stop correctly the machines so they need to be destroyed manually periodically. All machines live in ~/.jclouds/vagrant. Create in the folder and execute it to destroy machines created by the provider:

for node in `find ~/.jclouds/vagrant -name Vagrantfile | xargs -n1 dirname`; do
  pushd $node > /dev/null
  echo Destroying $node
  vagrant destroy --force
  popd> /dev/null
  rm -rf $machine

Same as a one-liner

for f in `find ~/.jclouds/vagrant/tests -name Vagrantfile | xargs -n1 dirname`; do pushd $f; vagrant destroy --force; popd; rm -rf $f; done


  • Machines are created sequentially, no support for parallel execution from virtualbox provider