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.
- Boot OpenStack Cloud instances.
- SSH into the instances.
- Provision the instances with any built-in Vagrant provisioner.
- Minimal synced folder support via
rsync. - Create instances with a specific list of networks
- Support for both keystone v2 and v3
Using keystone v3 :
$ 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}" # such as http://openstack.invalid/ without /v3/auth/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.region = "${OS_REGION_NAME}"
os.project_name = "${OS_PROJECT_NAME}"
os.project_domain_id = "${OS_PROJECT_DOMAIN_ID}"
os.user_domain_name = "${OS_USER_DOMAIN_NAME}"
os.identity_api_version = 'v3'
end
end
EOF
$ vagrant up --provider=openstack
...You can use a Vagrantfile that looks like this.
This provider exposes quite a few provider-specific configuration options:
api_key- The API key for accessing OpenStack.flavor- The server flavor to boot. This can be a string matching the exact ID or name of the server, or this can be a regular expression to partially match some server flavor.image- The server image to boot. This can be a string matching the exact ID or name of the image, or this can be a regular expression to partially match some image.availability_zone- The availability zone to use with nova, this allows to choose which zone your instance will exist on.endpoint- The keystone authentication URL of your OpenStack installation.server_name- The name of the server within the OpenStack Cloud. This defaults to the name of the Vagrant machine (viaconfig.vm.define), but can be overridden with this.username- The username with which to access OpenStack.keypair_name- The name of the keypair to access the machine.ssh_username- The username to access the machine.public_network_name- The name of the public network within your Openstack clusternetworks- A list -- use %w(net1 net2) -- of networks to configure on your instance.tenant- (Deprecated) The name of the tenant on which the virtual machine should spawn.
Keystone v3 specific configuration , Having one of those settings incorrect
will result in an 401: Unauthorized in keystone.
project_name- The name of the project on which the virtual machine should spawn , used to betenantproject_id- The id of the tenant on which the virtual machine should spawndomain_name- which domain to use to authenticatedomain_id- the id of the domainproject_domain_name- In which domain your project existsproject_domain_id- The id of the domain your project existsuser_domain_name- In which domain your user exists inuser_domain_id- the id of the domain your user exists inidentity_api_version- Which version of keystone, specifying this to3will autocomplete your url with /v3/auth/tokens to be forward compatible. Currently known version are2.0,3
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
endNetworking 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.
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!
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
tools/reinstall.shreinstall the plugin in your local vagrantDockefilebuild the project and run the tests without rubydocker build .
