mat128 / vagrant-openstack-cloud-provider

Use Vagrant to manage OpenStack Cloud instances.
MIT License
24 stars 17 forks source link

Vagrant OpenStack Cloud Provider

Build Status

This is a Vagrant 1.2+ plugin that adds an OpenStack Cloud provider to Vagrant, allowing Vagrant to control and provision machines within an OpenStack cloud.

This plugin started as a fork of the Vagrant Rackspace provider.

Note: This plugin requires Vagrant 1.2+. The last version of this plugin supporting Vagrant 1.1 is 0.3.0.

Features

Usage

$ vagrant plugin install vagrant-openstack-cloud-provider
$ cat <<EOF > Vagrantfile
require 'vagrant-openstack-cloud-provider'

Vagrant.configure("2") do |config|

  # This is a publicly available dummy box.
  config.vm.box = "sharpie/dummy"

  config.vm.provider :openstack do |os|
    os.username = "${OS_USERNAME}"
    os.api_key  = "${OS_PASSWORD}"
    os.flavor   = /m1.tiny/
    os.image    = /Ubuntu/
    os.endpoint = "${OS_AUTH_URL}/tokens"
    os.keypair_name = "" # Your keypair name
    os.ssh_username = "" # Your image SSH username
    os.public_network_name = "public" # Your Neutron network name
    os.networks = %w() # Additional neutron networks
    os.tenant = "${OS_TENANT_NAME}"
    os.region = "${OS_REGION_NAME}"
  end
end
EOF
$ vagrant up --provider=openstack
...

Configuration

This provider exposes quite a few provider-specific configuration options:

These can be set like typical provider-specific configuration:

Vagrant.configure("2") do |config|
  # ... other stuff

  config.vm.provider :openstack do |os|
    os.username = "mitchellh"
    os.api_key  = "foobarbaz"
  end
end

Networks

Networking features in the form of config.vm.network are not supported with vagrant-openstack, currently. If any of these are specified, Vagrant will emit a warning, but will otherwise boot the OpenStack server.

Synced Folders

There is minimal support for synced folders. Upon vagrant up, vagrant reload, and vagrant provision, the OpenStack provider will use rsync (if available) to uni-directionally sync the folder to the remote machine over SSH.

This is good enough for all built-in Vagrant provisioners (shell, chef, and puppet) to work!

Development

To work on the vagrant-openstack-cloud-provider plugin, clone this repository out, and use Bundler to get the dependencies:

$ bundle

Once you have the dependencies, verify the unit tests pass with rake:

$ bundle exec rake

If those pass, you're ready to start developing the plugin. You can test the plugin without installing it into your Vagrant environment by just creating a Vagrantfile in the top level of this directory (it is gitignored) that uses it, and uses bundler to execute Vagrant:

$ bundle exec vagrant up --provider=openstack