Module: PoolParty::Capistrano
- Included in:
- Capistrano::Configuration
- Defined in:
- lib/poolparty/capistrano.rb
Instance Method Summary collapse
-
#cloud_master(name) ⇒ Object
Get the master ip for the cloud to set in the deploy.rb file.
- #cloud_retrieved_already? ⇒ Boolean
- #get_cloud(name) ⇒ Object
- #set_cloud(name) ⇒ Object
- #set_poolparty_file(file) ⇒ Object
- #set_role_for_all_instances(role, name) ⇒ Object
Instance Method Details
#cloud_master(name) ⇒ Object
Get the master ip for the cloud to set in the deploy.rb file
37 38 39 |
# File 'lib/poolparty/capistrano.rb', line 37 def cloud_master(name) get_cloud(name).ip end |
#cloud_retrieved_already? ⇒ Boolean
29 30 31 |
# File 'lib/poolparty/capistrano.rb', line 29 def cloud_retrieved_already? $cap_clouds.key?(name) end |
#get_cloud(name) ⇒ Object
32 33 34 |
# File 'lib/poolparty/capistrano.rb', line 32 def get_cloud(name) set_cloud(name) end |
#set_cloud(name) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/poolparty/capistrano.rb', line 14 def set_cloud(name) cld = PoolParty::Cloud.cloud(name) if cld && !cloud_retrieved_already? $cap_clouds[name] = cld @cloud = cld instance_eval <<-EOE ssh_options[:keys] = [ '#{cld.full_keypair_path}' ] set :user, '#{cld.user}' set :username, "#{cld.user}" ssh_options[:forward_agent] = true EOE end cld end |
#set_poolparty_file(file) ⇒ Object
10 11 12 |
# File 'lib/poolparty/capistrano.rb', line 10 def set_poolparty_file(file) load_pool file end |
#set_role_for_all_instances(role, name) ⇒ Object
41 42 43 44 |
# File 'lib/poolparty/capistrano.rb', line 41 def set_role_for_all_instances(role, name) ips = get_cloud(name).nodes(:status => "running").map {|ri| ri.ip } ips.each {|ip| send :role, role.to_sym, "#{ip}"} end |