Hi Dieter,
you know you're kinda "fighting the system" with this one, right?
Capistrano suggests you give 'deploy' user passwordless sudo privileges. You can read about it
here, the 'Authorization' section.
Anyway, if you still wanna do it maybe you can have something like this in the stage file:
# your standard roles here
# privileged roles here (same server though)
Essentially, you're defining another set of roles with a privileged user. Notice you're not doing any deployment with the privileged user (no_release is true).
So now you can define your tasks:
task :my_task do
on roles(:privileged_app) do
# stuff here
end
end
As for the 3rd party plugins, they should enable you to explicitly set a role that does 3rd party task. Something like this in the stage file:
set :third_party_plugin_role, :privileged_app
Please note, I didn't try this (and I don't intend to), but maybe it helps or gives you other ideas.
For the least amount of headache, I'd still suggest following the capistrano suggestion and enabling passwordless sudo if possible.
Bruno