vagrant-rightscale

Provision your vagrant boxes using RightScale ServerTemplates.

Requirement

You must have Vagrant 1.2 or greater installed. Please see the vagrant documentation for instructions. This was tested on Vagrant 1.2.7, so I would start with that.

Installation

1) Install vagrant-rightscale plugin

$ vagrant plugin install vagrant-rightscale
Installing the 'vagrant-rightscale' plugin. This can take a few minutes...
Installed the plugin 'vagrant-rightscale (0.1.0)'!

2) Setup RightScale account configuration file

Copy configuration file into your home dir and secure it:

> cp config/vagrant-rightscale.cfg.example ~/.vagrant-rightscale.cfg
> chmod 600 ~/.vagrant-rightscale.cfg

Then edit ~/.vagrant-rightscale.cfg by adding your RightScale dashboard credentials.

Getting Started

Preparing your ServerTemplate.

We will be provisioning your Vagrant box out of the clear-blue sky (i.e. without an IaaS cloud-orchestration layer involved). To do this, the RightScale platform has a cloud-type currently code-named "BlueSkies". This functionally is currently an internal feature, contact [email protected] to request that this feature be enabled for your account.

Once enabled, you will need to configure your own ServerTemplate to support launching on the BlueSkies cloud. Here is an example of how to enable the Base ServerTemplate for Linux to launch on BlueSkies...

  1. Import the Base ServerTemplate for linux into your RightScale account from the RightScale Marketplace. To do so click here.
  2. Clone the newly imported ServerTemplate and rename to something like "TEST: Base ServerTemplate for Linux (v13.4) with BlueSkies"
  3. Create a BlueSkies MCI by going to Design > MultiCloud Images > New. Give it a name like "BlueSkies" and click save.
  4. Then click on the Cloud(s) drop-down on the Clouds tab of the MCI, select the 'BlueSkies' cloud and then save. If you do not see 'BlueSkies' as an option it has not been enabled for your account.
  5. Add the provides:rs_agent_type=right_link tag to your MCI -- this tells RightScale that the image uses RightLink for communication.
  6. Now go to the "images" tab of your cloned ServerTemplate, add your new BlueSkies MCI and make it the default MCI.

That's it. Now you are ready to configure your Vagrantfile and launch your local VM.

Configure Vagrantfile

Create a project directory

> mkdir ~/my_dev_project

Copy the config/Vagrantfile into your project directory:

> cp config/Vagrantfile ~/my_dev_project

Then edit ~/my_dev_project/Vagrantfile to point to the ServerTemplate you want and setup any inputs.

Launch

Launch a local VM:

> cd ~/my_dev_project
> vagrant up

Once your vagrant VM is provisioned, you can login to your VM using:

> vagrant ssh

Shutdown your VM:

> vagrant destroy

Bugs and Known Limitations

  • Cannot have duplicate server names in account -- should only search for servers within specified deployment
  • does not terminate servers in dashboard or do any cleanup -- you must login and manually delete servers.
  • fails without a good error message if "RS_rn_auth" is not in the userdata

Troubleshooting

  • Are you sure you added the provides:rs_agent_type=right_link tag to your MCI?
  • You will need to enable virtualization in the BIOS of your workstation.

Development

To work on the vagrant-rightscale plugin, clone this repository, 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 this plugin without installing it into your Vagrant environment. To do so, place a Vagrantfile in the top level of this directory (it is gitignored). For example:

> cp config/Vagrantfile .

Then use bundler to execute Vagrant:

> bundle exec vagrant up

TODO

  • add spec tests
  • add support for specifying ssh keys in Vagrantfile
  • add support for specifying datacenter/zones in Vagrantfile
  • add support for specifying security_groups in Vagrantfile
  • delete server in RightScale dashboard when running vagrant destroy
  • add i18n support in errors.rb

Possible Beta Testers

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

LICENSE:

Author:: Cary Penniman ([email protected]) Copyright:: Copyright (c) 2013 RightScale, Inc. License:: Apache License, Version 2.0

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.