Since Vagrant is so tightly integrated in my personal development and learning workflow and my job basically revolves around OpenStack it was about time for me to combine both of them.
I have to admit that at first I did not see the value of using Vagrant to provision machines in OpenStack. OpenStack already provides me with a very powerful command line and web interface, cloud-init to customize the machines and with Heat I can provision complex environments with ease. However after playing a bit with it I can see real value on combining both technologies for testing and learning purposes.
Anatomy of the Vagrantfile for OpenStack
Besides of the common options for any Vagrantfile there is a set of minimum options for the OpenStack provider as described in the provider Github repository.
os.tenant_name - The tenant where we will provision our instance.
os.username and os.password - The credentials for the above tenant.
os.flavor and os.image - Defining the flavor and base image for the instance.
os.floating_ip_pool - The IP pool for Nova assign the ip pool from in order to allow SSH to the instance.
There are other options that are mandatory if you ask me, like os.keypair_name and config.ssh.private_key_path that define the SSH key pair to be injected to the instance or os.networks which defines the tenant network to connect the instance to.
Below is the Vagrantfile I have used for my test in my lab Red Hat OpenStack installation.
Provision your first instance
With our Vagrantfile ready, kicking off a new instance follows the same logic as always with a simple vagrant up --provider openstack.
I am planning on investigating more in deep this provider so you can expect more articles around this in the future. Also I have created a new Github repo with the above Vagrantfile and will upload more samples from my day to day tests.