invoke remote site as root, use /etc/ganeti.hosts
authorDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 17 Feb 2020 23:35:07 +0000 (00:35 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 17 Feb 2020 23:35:35 +0000 (00:35 +0100)
emulator/gnt-cluster

index 75194fb..75b0ded 100755 (executable)
@@ -2,7 +2,7 @@
 
 op=$1 ; shift
 
-test -z "$1" && exit 1
+test -z "$1" && echo "Usage: $0 command id" && exit 1
 
 if [ "$op" = "command" ] ; then
 
@@ -12,19 +12,21 @@ 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
 
-       rsync $1 lib10:$1
-       rsync $1 lib20:$1
+       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