Multiple after_deploys in deploy.rb


  I am using Capistrano to do a deploy to servers with different roles.   I want call after_deploy in the following manner.

  task :after_deploy, :roles => [:rolea] do     run "task a"   end

  task :after_deploy, :roles => [:roleb] do     run "task b"   end

The problem seems that the second after_deploy clobbers the first even though they are meant for different roles. I do a workaround now by making role a use after_symlink, but now I am adding a few more roles and I am running out of after_* to workaround. Is there a way to do the following

  task :after_deploy do     if current_server.role == :rolea       run "task a"     elsif current_server.role == :roleb       run "task b"     end   end

Thanks in advance for the help.