I have a task in capistrano wherein I want just a single line to run only if the server is a marked as primary. Is there a variable or method that I can reference inside a task? 'primary?' or 'primary' doesn't seem to work.
I've also tried something akin to the following:
after "deploy", "task1"
after "deploy", "task2"
after "deploy", "task3"
task :task1, :roles => :app do
*code*
end
task :task2, :roles => :app, :only => {:primary => true} do
*code for just primary server*
end
task :task3, :roles => :app do
*more code*
end
But even this doesn't seem to work (all three tasks get run on every server).
I've been working on this on and off for a few days and I'm having no luck with my searches. Thoughts?