That approach certainly works. In fact, I think it's the simplest approach. There are others (involving programmatically identifying which servers are active in a group, and then restricting subsequent run() calls to those servers), but I'd recommend what you have. If you're worried about duplicating code inside each subtask, you can just define a function and call the function from each:

  def deploy_war_guts
    run(...)
    run(...)
    ...
  end

  1.upto(3) do |group|
task("deploy_war_group#{group}", :roles => :biz, :only => { :group => group }) do
      deploy_war_guts
    end
  end

- Jamis

On Aug 26, 2008, at 12:52 PM, Owen wrote:


We've been using capistrano to manage our Java deployments using
tomcat and BigIP to control load balancing.

We need to deploy to groups within a role to avoid taking the whole
site out, but want to maintain the the complete list of servers for a
particular role. Is there a better way than the following to achieve
the desired effect?

role :biz, "biz1", "biz2", :group => 1
role :biz, "biz3", "biz4", :group => 2
role :biz, "biz5", "biz6", :group => 3

task :deploy_war_group1, :roles => :biz, :only => { :group => 1 } do
  ...
end

task :deploy_war_group2, :roles => :biz, :only => { :group => 2 } do
 ...
end

task :deploy_war_group3, :roles => :biz, :only => { :group => 3 } do
 ...
end


task :deploy_war, :roles => :biz do
  deploy_war_group1
  deploy_war_group2
  deploy_war_group2
end

Thanks.

--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---


Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to