I use Capistrano everyday. To deploy a Tomcat WAR, to search for a domU across many dom0s, to deploy and update ssh public keys across many servers, to create user accounts and change their credentials, etc.
It makes those little repetitive tasks more enjoyable. It makes my sysadmin life easier.
To organize all the capistrano tasks and roles I use a little trick in my $HOME/.caprc file:
# vim: filetype=ruby
#
# Roles must be the first files loaded, before any task files
#
Dir.glob("#{ENV['HOME']}/.capistrano/roles/*.cap") do |file|
load file
end
#
# Task files
#
Dir.glob("#{ENV['HOME']}/.capistrano/tasks/*.cap") do |file|
load file
end
I put my roles in $HOME/.capistrano/roles and my tasks in $HOME/.capistrano/tasks. That way, all my roles and tasks are loaded automatically whenever I use cap.
I've found this is a great way to keep my capfiles organized. However, there is a gotcha: If you don't specify :roles in your task and you don't use the ROLES environment variable, all the roles defined will be used next time you run a task!
Fortunately, this is easily avoided adding the following line at the end of the .caprc file:
ENV['ROLES'] = '' if ENV['ROLES'].nil?
That way, I'm always forced to use ROLES when running a task.
Long live to Capistrano!