Hi,

I'd like to run a local task before anything else runs (to populate my
roles). Is there a callback I can use to do that?

eg. I'm doing something like this:

role :partition do end
role :queue_processor do end
role :web do end

# Custom tasks for our local machine.
namespace :local do

    desc <<-DESC
        Populate all roles
    DESC
    task :populate_roles do
        enum_partition
        enum_queue_processor
    end

end

task :enum_partition do
    desc "Enumerate hosts that are partition servers from puppet DB"
    cmd = 'sc_hosts.rb --class profile::partition'
    capture(cmd).each do |host|
        next unless host.chomp
        role(:partition, host)
        role(:web, host)
    end
end

task :enum_queue_processor do
    desc "Enumerate hosts having $HOME/queue_processor"
    cmd = 'sc_hosts.rb --class app::tree::queue_processor'
    capture(cmd).each do |host|
        next unless host.chomp
        role(:queue_processor, host)
        role(:web, host)
    end
end

What I'm looking for is a suitable callback to run populate_hosts before
any other tasks, ie.

before '????????', 'local:populate_roles'

Can anyone suggest what I might use?

R.

-- 
* You received this message because you are subscribed to the Google Groups 
"Capistrano" group.
* To post to this group, send email to [email protected]
* To unsubscribe from this group, send email to 
[email protected] For more options, visit this group at 
http://groups.google.com/group/capistrano?hl=en

Reply via email to