Vagrant OpenStack Tutorial: Using Vagrant with Platform9 Managed OpenStack
Developers and end users can use Vagrant to deploy virtual machines on Platform9 Managed OpenStack. This tutorial describes the steps to do so.
We use following GitHub Vagrant OpenStack plugin for this tutorial:
Step 1 – Download and Install Vagrant Plugin for OpenStack
Download and install the vagrant plugin for OpenStack on your machine.[bash]vagrant plugin install vagrant-openstack-provider[/bash]
Step 2 – Create a Dummy Vagrant Box for OpenStack
Vagrant has a concept of ‘boxes’ which are package format for Vagrant environments. For the purpose of connecting to a remote OpenStack endpoint, we need to create a dummy Vagrant box.[bash]vagrant box add dummy https://github.com/cloudbau/vagrant-openstack-plugin/raw/master/dummy.box[/bash]
Step 3 – Configure Your Vagrantfile
Create a new directory and copy the Vagrantfile that is provided with this tutorial into the directory.
Customize the Vagrantfile to fill in parameters specific to your Platform9 Managed OpenStack account, and other details. The sample Vagrantfile provided here offers plenty of comments to help.
Step 4 – Deploy the VM[bash]vagrant up –provider=openstack[/bash]
This will start a VM in your Platform9 environment and ssh into it directly.
Congratulations! Your Vagrant box was just deployed! Vagrant and Platform9 did the necessary work of deploying the VM onto your underlying infrastructure.
You can also use:
- ‘vagrant destroy’ to kill the VM
- ‘vagrant ssh’ to ssh into an already created VM.
- NOTE: Vagrant does not like it if you delete a VM behind Vagrant’s back. To reset Vagrant’s state in such situations, do ‘vagrant openstack reset’