Merge branch 'master' of github.com:ffzg/gnt-info
[gnt-info] / emulator / gnt-cluster
index 7c79eea..75b0ded 100755 (executable)
@@ -2,6 +2,8 @@
 
 op=$1 ; shift
 
+test -z "$1" && echo "Usage: $0 command id" && exit 1
+
 if [ "$op" = "command" ] ; then
 
        show_machine=0
@@ -10,14 +12,26 @@ if [ "$op" = "command" ] ; then
                show_machine=1
        fi
 
-       for host in lib10 lib15 lib20 ; do
+       for host in $(cat /etc/ganeti.hosts) ; do
 
                prefix=''
                test $show_machine && prefix="$host: "
                #echo "# ssh $host $*"
-               ssh $host $* | sed "s/^/$prefix/"
+               ssh root@$host $* | sed "s/^/$prefix/"
+
+       done
+
+elif [ "$op" = "copyfile" ] ; then
 
+       my_hostname=$(hostname -s)
+       for host in $(cat /etc/ganeti.hosts | grep -v $my_hostname) ; do
+               rsync $1 root@$host:$1
        done
+
+elif [ "$op" = "install" ] ; then # use as "install it" since needs install command and arg
+
+       ln -sfv `pwd`/gnt-cluster /usr/local/bin/
+
 else
        echo "UNKNOWN [$op] $*"
        exit 1