Pete, yes you can pass a Proc object as the value of the :roles option,
and it will get evaluated when the task is considered for execution. The
proc should return an array of role names.

Capistrano provides a defer() helper to make declaring the procs a bit
easier to read:

  task :generic_task, :roles => defer { compute_role_names_here } do
    # ...
  end

- Jamis

On 1/16/09 1:48 PM, pete wrote:
> Hello-
> 
> Is it possible to dynamically set roles for a specific task?
> 
> For example, I want to create some generic tasks, along with groups of
> servers I use, and I wan tto be able to execute these commands on
> different groups, without having to duplicate code.
> 
> role :group1, m1, m2, m3
> role :group2, m4, m5, m6
> 
> task :generic_task, :roles => [some passed in variable] do
> run "echo hi"
> end
> 
> Is something like this possible?  I have tried a couple options, none
> of which worked.
> 
> Thanks!
> > 


--~--~---------~--~----~------------~-------~--~----~
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