The way I've done this is a little hack, but it works :)
You can use any of run/sudo/put/etc in the block too

def run_for_hosts(hosts)
  hosts.each do |h|
    task "run_for_#{h}", :hosts => h do
      yield h
    end
    eval "run_for_#{h}"
  end
end

task :my_task do
  run_for_hosts(['staging', 'host2']) do
    run "echo hi"
  end
end

Hope this helps,

Matt



On Jan 19, 3:55 pm, "Dick Davies" <[EMAIL PROTECTED]> wrote:
> Hi all
>
> I finally took the time to try out capistrano yesterday - been meaning
> to since it was switchtow*r -
>  and I really wish I'd tried it years ago :)
> It'll be really handy for dozens of sysadmin jobs around the place.
>
> I'm working on a way to assemble a single docroot from various pieces
> of content on different publishing sources
> (dreamweaver sites, a CMS, etc).
>
> I'd like to use capistrano for this (largely because of it's parallel
> execution and gatewaying) but it seems I can
> only run the same command on each host in a role - is that right?
>
> My current design is based on Source objects,  that know what commands
> to run to ssh to the source,
> check if it's ready and if so rsync it over etc.
> (with some added logic to avoid "rsync --delete" clobbering
> subdirectories that come from another server etc.)
>
> in its simplest form, what I'm trying to do boils down to:
>
> sources.each do |source|
>  "ssh #{source.server} #{source.send_command}"
> end
>
> but I can't see if that's doable within capistrano. Any ideas?
>
> Thanks!
>
> --
> Rasputnik :: Jack of All Trades - Master of 
> Nunshttp://number9.hellooperator.net/
--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---

Reply via email to