#!/bin/bash

command=$@

hosts=(
<#list hosts as host>
  ${host.ip}
</#list>
)

for host in <#noparse>${hosts[@]}</#noparse>
do
  hostname=`ssh $host 'echo $HOSTNAME'`
  echo "$host $hostname"
  ssh $host $command
done
