Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Switched to using Fog::Rackspace (duh). Works well enough, though sec…

…urity groups, volumes, tags, and ssh-keys are all in various states of dishabille.
  • Loading branch information...
commit 61c0cccc3e9b67bcbd316e5dea20d9116e90d0fc 1 parent de66b1c
@temujin9 temujin9 authored
View
2  lib/chef/knife/cluster_bootstrap.rb
@@ -60,7 +60,7 @@ class ClusterBootstrap < Ironfan::Script
def perform_execution(target)
# Execute across all servers in parallel
- threads = target.servers.map{ |server| Thread.new(server) { |svr| run_bootstrap(svr, svr.fog_server.ipaddress) } }
+ threads = target.servers.map{ |server| Thread.new(server) { |svr| run_bootstrap(svr, svr.fog_server.addresses["public"].first) } }
# Wait for the threads to finish and return the array of thread's exit value
threads.map{ |t| t.join.value }
end
View
8 lib/chef/knife/cluster_launch.rb
@@ -109,12 +109,16 @@ def perform_after_launch_tasks(server)
end
# Make sure our list of volumes is accurate
- Ironfan.fetch_fog_volumes
- server.discover_volumes!
+# Ironfan.fetch_fog_volumes
+# server.discover_volumes!
# Attach volumes, etc
server.sync_to_cloud
+ Chef::Log.debug("connecting to server with password = #{server.fog_server.password}")
+
+ server.fog_server.setup :password => server.fog_server.password
+
# Run Bootstrap
if config[:bootstrap]
run_bootstrap(server, server.fog_server.public_ip_address)
View
21 lib/ironfan/cloud.rb
@@ -248,9 +248,24 @@ def list_flavors
end
end
+ # 1 256 server 256 10 GB
+ # 2 512 server 512 20 GB
+ # 3 1GB server 1024 40 GB
+ # 4 2GB server 2048 80 GB
+ # 5 4GB server 4096 160 GB
+ # 6 8GB server 8192 320 GB
+ # 7 15.5GB server 15872 620 GB
+ # 8 30GB server 30720 1200 GB
FLAVOR_INFO = {
- '1' => { :price => 0.00, :bits => '64-bit', :ram => 256, :cores => 1, :core_size => 0.25, :inst_disks => 0, :inst_disk_size => 0, :ephemeral_volumes => 0 },
+ '1' => { :price => 0.00, :bits => '64-bit', :ram => 256, :cores => 1, :core_size => 0.25, :inst_disks => 1, :inst_disk_size => 10, :ephemeral_volumes => 0 },
+ '2' => { :price => 0.00, :bits => '64-bit', :ram => 512, :cores => 1, :core_size => 0.25, :inst_disks => 0, :inst_disk_size => 20, :ephemeral_volumes => 0 },
+ '3' => { :price => 0.00, :bits => '64-bit', :ram => 1024, :cores => 1, :core_size => 0.25, :inst_disks => 0, :inst_disk_size => 40, :ephemeral_volumes => 0 },
+ '4' => { :price => 0.00, :bits => '64-bit', :ram => 2048, :cores => 1, :core_size => 0.25, :inst_disks => 0, :inst_disk_size => 80, :ephemeral_volumes => 0 },
+ '5' => { :price => 0.00, :bits => '64-bit', :ram => 4096, :cores => 1, :core_size => 0.25, :inst_disks => 0, :inst_disk_size => 160, :ephemeral_volumes => 0 },
+ '6' => { :price => 0.00, :bits => '64-bit', :ram => 8192, :cores => 1, :core_size => 0.25, :inst_disks => 0, :inst_disk_size => 320, :ephemeral_volumes => 0 },
+ '7' => { :price => 0.00, :bits => '64-bit', :ram => 15872, :cores => 1, :core_size => 0.25, :inst_disks => 0, :inst_disk_size => 620, :ephemeral_volumes => 0 },
+ '8' => { :price => 0.00, :bits => '64-bit', :ram => 30720, :cores => 1, :core_size => 0.25, :inst_disks => 0, :inst_disk_size => 1200, :ephemeral_volumes => 0 },
}
#
@@ -265,8 +280,8 @@ def list_flavors
#
Chef::Config[:rackspace_image_info] ||= {}
Chef::Config[:rackspace_image_info].merge!({
- %w[ 64-bit natty ] => { :image_id => '115', :ssh_user => 'ubuntu', :bootstrap_distro => "ubuntu10.04-gems", },
- %w[ 64-bit oneiric ] => { :image_id => '119', :ssh_user => 'ubuntu', :bootstrap_distro => "ubuntu10.04-gems", },
+ %w[ 64-bit natty ] => { :image_id => '115', :ssh_user => 'root', :bootstrap_distro => "ubuntu10.04-gems", },
+ %w[ 64-bit oneiric ] => { :image_id => '119', :ssh_user => 'root', :bootstrap_distro => "ubuntu10.04-gems", },
})
end
View
14 lib/ironfan/discovery.rb
@@ -78,7 +78,7 @@ def discover_chef_nodes!
end
svr = Ironfan::Server.get(cluster_name, facet_name, facet_index)
svr.chef_node = chef_node
- @rackspace_instance_hash[ chef_node.rackspace.instance_id ] = svr if chef_node[:rackspace] && chef_node.rackspace.instance_id
+ @rackspace_instance_hash[ chef_node.rackspace.instance_id ] = svr if chef_node[:rackspace] && chef_node.rackspace.respond_to?(:instance_id)
end
end
@@ -143,10 +143,14 @@ module Ironfan
def self.fog_connection
@fog_connection ||= Fog::Compute.new({
- :provider => 'OpenStack',
- :openstack_api_key => Chef::Config[:knife][:rackspace_api_key],
- :openstack_username => Chef::Config[:knife][:rackspace_username],
- :openstack_auth_url => Chef::Config[:knife][:rackspace_auth_url]
+ :provider => 'Rackspace',
+ :rackspace_api_key => Chef::Config[:knife][:rackspace_api_key],
+ :rackspace_username => Chef::Config[:knife][:rackspace_username],
+# :provider => 'OpenStack',
+# :openstack_api_key => Chef::Config[:knife][:rackspace_api_key],
+# :openstack_username => Chef::Config[:knife][:rackspace_username],
+# :openstack_auth_url => Chef::Config[:knife][:rackspace_auth_url],
+# :openstack_compute_service_name => Chef::Config[:knife][:rackspace_compute_service_name]
})
end
View
11 lib/ironfan/fog_layer.rb
@@ -24,17 +24,20 @@ def fog_launch_description
if client_key.body then cloud.user_data.merge({ :client_key => client_key.body })
else cloud.user_data.merge({ :validation_key => cloud.validation_key }) ; end
#
+ private_key_file = File.join(Chef::Config.rackspace_key_dir, "#{cloud.keypair.to_s}.pem")
{
:image_id => cloud.image_id,
:flavor_id => cloud.flavor,
:name => self.fullname,
:groups => cloud.security_groups.keys,
:key_name => cloud.keypair.to_s,
+ :private_key_file => private_key_file,
+ :public_key => `ssh-keygen -y -f #{private_key_file}`,
:metadata => {
:cluster => cluster_name.to_s,
:facet => facet_name.to_s,
:index => facet_index.to_s, },
- :user_data => JSON.pretty_generate(user_data_hsh),
+# :user_data => JSON.pretty_generate(user_data_hsh),
:block_device_mapping => block_device_mapping,
:availability_zone => self.default_availability_zone,
:monitoring => cloud.monitoring,
@@ -134,7 +137,8 @@ def check_server_id_pairing thing, desc
class ServerSlice
def sync_keypairs
- step("ensuring keypairs exist - DISABLED!")
+ Chef::Log.debug("ensuring keypairs exist - DISABLED")
+# step("ensuring keypairs exist - DISABLED")
# keypairs = servers.map{|svr| [svr.cluster.cloud.keypair, svr.cloud.keypair] }.flatten.map(&:to_s).reject(&:blank?).uniq
# keypairs = keypairs - Ironfan.fog_keypairs.keys
# keypairs.each do |keypair_name|
@@ -145,7 +149,8 @@ def sync_keypairs
# Create security groups, their dependencies, and synchronize their permissions
def sync_security_groups
- step("ensuring security groups exist and are correct - DISABLED!")
+ Chef::Log.debug("ensuring security groups exist and are correct - DISABLED")
+# step("ensuring security groups exist and are correct - DISABLED")
# security_groups.each{|name,group| group.run }
end
View
2  lib/ironfan/private_key.rb
@@ -31,7 +31,7 @@ def save
Chef::Log.debug(" key #{name} - dry run, not writing out key")
return
end
- ui.info( " key #{name} - writing to #{filename}" )
+ Chef::Log.debug( " key #{name} - writing to #{filename}" )
FileUtils.mkdir_p(File.dirname(filename))
File.open(filename, "w", 0600){|f| f.print( @body ) }
end
View
4 lib/ironfan/server.rb
@@ -232,8 +232,8 @@ def self.all
def sync_to_cloud
step "Syncing to cloud"
- attach_volumes
- create_tags
+# attach_volumes
+# create_tags
associate_public_ip
end
View
2  lib/ironfan/server_slice.rb
@@ -186,7 +186,7 @@ def display hh = :default
"InstanceID" => (fs.id && fs.id > 0) ? fs.id : "???",
"Flavor" => fs.flavor_id,
"Image" => fs.image_id,
- "AZ" => fs.availability_zone,
+# "AZ" => fs.availability_zone,
# "SSH Key" => fs.key_name,
"State" => "[#{MACHINE_STATE_COLORS[fs.state] || 'white'}]#{fs.state}[reset]",
"Public IP" => fs.public_ip_address,
Please sign in to comment.
Something went wrong with that request. Please try again.