Created
June 11, 2013 21:23
-
-
Save maxlinc/5760841 to your computer and use it in GitHub Desktop.
All rackspace image/flavor combos
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'fog' | |
service = Fog::Compute.new({ | |
:provider => 'rackspace', | |
:rackspace_username => Fog.credentials[:rackspace_username], | |
:rackspace_api_key => Fog.credentials[:rackspace_api_key], | |
:version => :v2, # Use Next Gen Cloud Servers | |
:rackspace_region => :dfw | |
}) | |
nodes = [] | |
images = service.images | |
flavors = service.flavors | |
images.each do | image | | |
flavors.each do | flavor | | |
nodes << { | |
:name => "f#{flavor.id}_i#{image.id}", | |
:image => image.name, | |
:flavor => flavor.name | |
} | |
end | |
end | |
# Uncomment this if you just want to try the first couple to make sure this script is working | |
# nodes = nodes.slice(0, 5) | |
Vagrant.configure("2") do |config| | |
config.vm.box = "dummy" | |
config.ssh.private_key_path = "~/.ssh/id_rsa" | |
nodes.each do | node| | |
config.vm.define node[:name] | |
config.vm.provider :rackspace do |rs| | |
rs.username = Fog.credentials[:rackspace_username] | |
rs.api_key = Fog.credentials[:rackspace_api_key] | |
rs.flavor = node[:flavor] | |
rs.image = node[:image] | |
rs.public_key_path = "~/.ssh/id_rsa.pub" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment