60 lines
1.2 KiB
Text
60 lines
1.2 KiB
Text
|
#!/bin/bash
|
||
|
|
||
|
function help() {
|
||
|
cat << EOF
|
||
|
|
||
|
Usage: $(basename $0) <action> <node>
|
||
|
|
||
|
<action> [enable|disable|help]
|
||
|
<node> Nomenklatur ist <svc><cluster><env><node>
|
||
|
<svc> [jra|cnf] 3 characters
|
||
|
<cluster> [0-9] 1 character
|
||
|
<env> [pte] 1 character
|
||
|
<node> [0-9] 1 character
|
||
|
EOF
|
||
|
}
|
||
|
|
||
|
case $1 in
|
||
|
enable)
|
||
|
ACTION=enable
|
||
|
;;
|
||
|
disable)
|
||
|
ACTION=disable
|
||
|
;;
|
||
|
help)
|
||
|
help
|
||
|
exit 0
|
||
|
;;
|
||
|
*)
|
||
|
help
|
||
|
exit 1
|
||
|
;;
|
||
|
esac
|
||
|
shift
|
||
|
|
||
|
UMG=${1:4:1}
|
||
|
CLUSTER=${1:0:4}
|
||
|
NODE=${1:5:1}
|
||
|
LBS=( atlb${UMG}1 atlb${UMG}2 )
|
||
|
BACKENDS=( ${CLUSTER} ${CLUSTER}_direct )
|
||
|
SERVERS=( ${CLUSTER}${NODE} ${CLUSTER}${NODE}d )
|
||
|
HAADMINSOCK=/run/haproxy/admin.sock
|
||
|
|
||
|
i=0
|
||
|
while [ $i -lt ${#BACKENDS[@]} ];do
|
||
|
|
||
|
cat << EOF
|
||
|
Action: $ACTION
|
||
|
Umgebung: $UMG
|
||
|
Cluster: $CLUSTER
|
||
|
Node: $NODE
|
||
|
Loadbalancers: ${LBS[*]}
|
||
|
Backend: ${BACKENDS[$i]}
|
||
|
Server: ${SERVERS[$i]}
|
||
|
------------------------------------
|
||
|
|
||
|
EOF
|
||
|
parallel-ssh -i $(for l in ${LBS[@]};do echo -H $l;done) "echo '$ACTION server ${BACKENDS[$i]}/${SERVERS[$i]}'|socat stdio $HAADMINSOCK"
|
||
|
i=$((i+1))
|
||
|
done
|