Go to Google Groups Home    Capistrano
Re: [capistrano] Identify current host

Rafael G. <r...@aspgems.com>

Gary Richardson wrote:
> Hey,

> Two part question that I haven't been able to answer:

> 1) can I get the current host a task is executing on? I've read some
> stuff about $CAPISTRANO:HOST$, but it doesn't seem to work for me

I tested this task and works for me:

    task :host_name do
        run "host $CAPISTRANO:HOST$"
    end

What OS are you using? Could you paste your deploy.rb in
someplace(gist.github, pastie,...)?

> 2) if I have an array of values (let's say an array that maps ec2 host
> names to ec2 instance id's), can I use this same method to look up
> something from that array?

Capistrano uses ruby If you can do it with ruby you can do the same in a
capistrano task.

--
Rafa