views:

110

answers:

1

EDIT: rephrasing the question

Say you have two tasks. The first one determines a host name dynamically, and wants to invoke the second class only on that host.

task :first_task do
  host_name = ... 
  second_task, :hosts => hostname
end

task :second_task do
  run "some stuff"
end

As far as I can tell passing in :hosts doesn't work. Assigning the new host_name to a role, and having the second task use those roles would work, but that won't work on existing tasks. This does seem to be possible as the default deploy:setup works on passing in a HOSTS variable, but I can't figure out how that works.

A: 

Passing in a HOSTS variable is ENV['HOSTS'] if you look more closely.

Beaks
What I'd like to know is if ENV['HOSTS'] then passes some arguments to the task itself. I'd rather pass arguments then set an ENV variable.
phillee