I've handled this differently in the past. task upload_different_file do upload_different_file_for_app upload_different_file_for_worker end
task upload_different_file_for_app, :roles => [:app] do ... end task upload_different_file_for_worker, :roles => [:worker] do ... end you still only have to have one task you call to get the job done. the sub-tasks do the job of applying the files to the right roles, where you can make all the assumptions about which role your dealing with INSIDE the sub-task. On Tue, Jul 9, 2013 at 1:27 PM, Carlos Peñas <[email protected]> wrote: > There's a lot of questions arround this topic and I feel that there's no > direct solution. > > Is there a way to get the current role name for a task to use it in a > variable? > > This is what I'm trying to acomplish > > task upload_different_file do > upload "server_cfg/#{stage}/*#{computed_role}*/my_custom_and_needed_file" > "/tmp" > run "echo *#{computed_role}* >> /tmp/fancy_roles_enumeration" > ... and the like ... > end > > That's it. The role name should be arbitrary because this is planed to > upload several files to a server, based on its role declared > > I know that if there's a server with two roles calling twice to that kind > of task, it will lead to file collision, but I will handle that later. > > Is this posibble? > > Thanks > > . > > -- > -- > * You received this message because you are subscribed to the Google > Groups "Capistrano" group. > * To post to this group, send email to [email protected] > * To unsubscribe from this group, send email to > [email protected] For more options, visit this > group at http://groups.google.com/group/capistrano?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Capistrano" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- -- * You received this message because you are subscribed to the Google Groups "Capistrano" group. * To post to this group, send email to [email protected] * To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/capistrano?hl=en --- You received this message because you are subscribed to the Google Groups "Capistrano" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
