Vagrant with OpenStack

If you want to use Vagrant with OpenStack, you need to prepare Vagrant with installing the vagrant-openstack-plugin. I had some problems installing it directly through vagrant plugin install. I had to clone it from Github and install it manually.

One time configuration

Install OpenStack plugin in Vagrant

sudo apt-get install ruby1.9.1 git virtualbox
cd /tmp
# At writing moment the latest version of Vagrant is the following version.
sudo dpkg -i vagrant_1.7.2_x86_64.deb
git clone
cd vagrant-openstack-plugin
gem build vagrant-openstack-plugin.gemspec
vagrant plugin install vagrant-openstack-plugin-*.gem

Add a dummy box to Vagrant thats needed by the plugin.

vagrant box add dummy

Download OpenStack RC file

  • Log into OpenStack
  • Download OpenStack API RC file
  • Go to Project -> Compute -> Access & Security -> API Access
  • Down RC file by hitting Download OpenStack RC File
  • Put $ in your ~/ or somewhere you prefer

Configure a Vagrant VM


This is a default generic Vagrant file which starts a m1.tiny flavor image of Ubuntu Utopic. It requires that you already have added your ssh key to OpenStack. Please add your ssh key with the name $USER_ssh_key.

require 'vagrant-openstack-plugin'

Vagrant.configure("2") do |config| = "dummy"
  config.vm.synced_folder ".", "/vagrant", type: "rsync", rsync__exclude: ".git/"

  # Make sure the private key from the key pair is provided
  config.ssh.private_key_path = "~/.ssh/id_rsa"

  config.vm.provider :openstack do |os|
    os.username     = "#{ENV['OS_USERNAME']}"
    os.api_key      = "#{ENV['OS_PASSWORD']}"
    os.flavor       = /m1.tiny/
    os.image        = "Ubuntu CI trusty 2014-09-22"
    os.endpoint     = "#{ENV['OS_AUTH_URL']}/tokens"
    os.keypair_name = "#{ENV['OS_USERNAME']}_ssh_key"
    os.ssh_username = "ubuntu"

    # The tenant have two networks, so need to specify at least one = "vagrant"
    os.floating_ip        = :auto 
    os.floating_ip_pool   = "public"

  config.vm.provision "shell", path: ""

  config.vm.provision "shell", inline: <<-SCRIPT
    # Set your country code here to get a local repositroy
    grep -q /etc/apt/sources.list || sed -i~ "$" /etc/apt/sources.list
    apt-get update

  config.vm.define "myvm" do |v|

Create your custom bootstrap file.


# Your aditional bootstrap here...

Running Vagrant

Remember to source your OpenStack RC file before you run Vagrant up. You need to do that in each shell windows you are going to run Vagrant in.

source ~/$
vagrant up --provider openstack
vim: set syn=markdown spell spl=en: