You can get a list of all servers in a role like this:
servers = roles[:testtct].servers
That'll return an array of Capistrano::ServerDefinition objects. To get
the host name of a single server object, just do "server.host", e.g.:
puts "servers in testtct role:"
roles[:testtct].servers.each do |server|
puts "* #{server.host}"
end
However, what you REALLY want, is probably just to substitute the name
of the current server in the command, like so:
run "touch /tmp/$CAPISTRANO:HOST$"
Capistrano will always look for $CAPISTRANO:HOST$ in the command string,
and will replace it with the server's hostname at execution time.
- Jamis