# Are these capistrano tasks being executed on all roles ?!?

**URL:** <https://www.ruby-forum.com/t/are-these-capistrano-tasks-being-executed-on-all-roles/168632>\
**Category:** Deployment\
**Created:** [May 23, 2009, 8:21am UTC](https://www.ruby-forum.com/t/are-these-capistrano-tasks-being-executed-on-all-roles/168632 "2009-05-23T08:21:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jimdeuc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b77776/32.png) [@jimdeuc](https://www.ruby-forum.com/u/jimdeuc)\
**Post date:** [May 23, 2009, 8:21am UTC](https://www.ruby-forum.com/t/are-these-capistrano-tasks-being-executed-on-all-roles/168632/1 "2009-05-23T08:21:13Z")

</div>

I have an Apache front-end web server “server1”, an application server  
with Ruby and Thin “server2”, and a MySQL database server “server3”.  
Before I do a deployment I wanted to check what Capistrano is going to  
do to each server so I’ve been digging around the default recipes in the  
source code.

If I’m not mistaken, it seems that a lot of recipes are needlessly  
running on all three servers when the recipe only needs to be run on the  
application server. For instance here is the deploy:setup task:

task :setup, :except =\> { :no\_release =\> true } do  
dirs = [deploy\_to, releases\_path, shared\_path]  
dirs += shared\_children.map { |d| File.join(shared\_path, d) }  
run “#{try\_sudo} mkdir -p #{dirs.join(’ ‘)} && #{try\_sudo} chmod g+w  
#{dirs.join(’ ')}”  
end

Since it doesn’t have a :roles parameter, it would seem this is going to  
run on all three servers even though server1 and server3 won’t need  
these directories and won’t need the application files copied to them  
(which the update\_code task is also needlessly running on all three  
servers) when this task should only run on server2. By the default it  
looks like my application structure will be copied to three servers even  
though it’s only used on one.

So why don’t these default to just running on the server(s) in the :app  
role?
