Vagrant Up Multiple VMs on Rackspace Public Cloud

Using Vagrant with the local laptop is convenient for small workloads (2-3 VMs).  For larger workloads (3+ VMs), however, the MacBook Pro’s cooling fans start screaming at me.  I decided to try out a Public Cloud provider, and Rackspace’s 6-month Dev Trial was very appealing.  Read more on my experiences below…

The account setup process was a breeze in comparison to Amazon Web Services.  Once you’re signed up, you can either use the Web GUI, REST API, or nova client (!!!) to manage your environment.

That last bit is exciting since nova client trivializes important tasks such as getting a list of your instances (nova list), getting a list of your networks (nova network-list), creating a network (nova network-create), etc.  For those of you who are following along with the Couch to OpenStack Series, this kind of access will be a welcome feature.

After reviewing Mitchell Hashimoto’s notes on how to to use Vagrant with the Rackspace provider, I did some experimentation since I could not find any docs on how to do a multi-VM setup.  I took my first stab at it by modifying an existing C2OS Vagrantfile, and so far, everything is working as expected:

# -*- mode: ruby -*-
# vi: set ft=ruby :
# Ruby hash to specify the hostname and desired fourth octet
# Cannot currently specify the IP.  So, octet value is unused
nodes = {
'master' => 200,
'node1' => 210,


Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  # The "dummy" value is just a placeholder as explained
  # in Mitchell's notes = "dummy"
  # Specify your ssh private key for remote access
  config.ssh.private_key_path = "~/.ssh/id_rsa"

  # Use an "each" loop to build multiple VMs
  nodes.each do |node, fourth_octet|
    config.vm.define "#{node}" do |box|
      config.vm.provider :rackspace do |rs|
        rs.username = "vmtrooper"

        # API key is used instead of a password
        rs.api_key = "ffffffffff8675309ffffffffffffffffffff"

        # Server sizing determined by RAM assigned
        rs.flavor  = /1GB/

        # Multiple flavors of Linux and
        # versions of Windows are available
        rs.image   = /Ubuntu 13.10/

        # Specify your ssh public key to access the VM
        rs.public_key_path = "~/.ssh/"

        # Valid region values are :dfw :ord :iad :lon :syd
        rs.rackspace_region = :dfw

        # Network MUST reside in the same region as your servers
        # Get the network uuid using "nova network-list" 'ffffffffff-ffff-ffff-b77c-fffffffffff'

One caveat to using the Rackspace provider is that you cannot use the settings that we all know and love.  Instead, to specify an additional network (aside from the Public and Internal networks) you must use the statement with the uuid of the network that you created.

I left the old reference to the fourth octet of the ip address in the Vagrantfile in case the provider dev team ever figures out how to allow manual IP configuration.  Until then, your provisioning scripts will need to utilize ifconfig, or possibly facter, if you’d like to know the IP address for such tasks as modifying OpenStack configuration files.

With the Tech Speak out of the way, I’d like to thank all of you for continuing to check out my blog this year. I would also like to wish “Happy Holidays” to all of you and your families. Party hard (but responsibly), and I’ll see you again in 2014.

Leave a Reply

Your email address will not be published. Required fields are marked *