Provisioning Openstack Instances with Vagrant

vagrant openstack

Provisioning an instance on OpenStack now much easier with Vagrant, we use Vagrant custom provider to control and provision instances within OpenStack cloud from local environment. Create, boot, halt, reboot, suspend and resume OpenStack instances from Vagrant done in easy way and fast. Detail about vagrant openstack provider can be found on ggiamarchi github.

Step 1: Vagrant initialization

This will initializes the current directory to be a Vagrant environment by creating an initial Vagrantfile.

C:\pseudo\Vagrant>mkdir openstack
C:\pseudo\Vagrant>cd openstack
C:\pseudo\Vagrant\openstack>vagrant init

Step 2: Install Vagrant Openstack Provider

Download and install the vagrant OpenStack provider plugin.

C:\pseudo\Vagrant\openstack>vagrant plugin install vagrant-openstack-provider

If there are no error message occurs when installing vagrant openstack provider, continue to make some changes on Vagrantfile.

Step 3: Configure Vagrantfile

Configuration reference can be found from ggiamarchi github site.

require 'vagrant-openstack-provider'
Vagrant.configure('2') do |config|

 config.ssh.username = 'stack'
 config.vm.synced_folder ".", "/vagrant", disabled: true

 config.vm.provider :openstack do |osk|
   osk.openstack_auth_url = 'http://192.168.0.54/identity/v2.0/'
   osk.username = 'admin'
   osk.password = 'secret'
   osk.tenant_name = 'admin'
   osk.flavor = 'cirros256'
   osk.image = 'cirros-0.3.5-x86_64-disk'
   osk.floating_ip_pool = 'public'
   osk.server_name = 'dev.cirros'
   end
 end

Step 4: Deploy the Instance

This will start deploy an instance in your OpenStack environment.

C:\pseudo\Vagrant\openstack>vagrant up --debug

Step 5: Check Active Instance from OpenStack Dashboard

Instance on building state

Active Instance view from horizon after provisioning with vagrant