Skip to content

Instantly share code, notes, and snippets.

@andyhky
Created Dec 23, 2013
Embed
What would you like to do?
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Ruby hash to specify the hostname and desired fourth octet
# Cannot currently specify the IP. So, octet value is unused
nodes = {
'master' => 200,
'node1' => 210,
}
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# The "dummy" value is just a placeholder as explained
# in Mitchell's notes
config.vm.box = "dummy"
# Specify your ssh private key for remote access
config.ssh.private_key_path = "~/.ssh/id_rsa"
# Use an "each" loop to build multiple VMs
nodes.each do |node, fourth_octet|
config.vm.define "#{node}" do |box|
config.vm.provider :rackspace do |rs|
rs.username = "vmtrooper"
# API key is used instead of a password
rs.api_key = "ffffffffff8675309ffffffffffffffffffff"
# Server sizing determined by RAM assigned
rs.flavor = /1 GB/
# Multiple flavors of Linux and
# versions of Windows are available
rs.image = /Ubuntu 13.10/
# Specify your ssh public key to access the VM
rs.public_key_path = "~/.ssh/id_rsa.pub"
# Valid region values are :dfw :ord :iad :lon :syd
rs.rackspace_region = :dfw
# Network MUST reside in the same region as your servers
# Get the network uuid using "nova network-list"
rs.network 'ffffffffff-ffff-ffff-b77c-fffffffffff'
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment