maketank-scripts from ansible
This commit is contained in:
18
roles/mkt-scripts/files/update-motd.d/20-mkt-failover
Executable file
18
roles/mkt-scripts/files/update-motd.d/20-mkt-failover
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
echo
|
||||
echo "FailoverIPs on hosts"
|
||||
OUT=$(curl -u '#ws+7PVgXWxp:UypGThnJ5KJDXTCN' https://robot-ws.your-server.de/failover 2>/dev/null)
|
||||
#OUT=$(cat fo)
|
||||
|
||||
#echo $OUT |
|
||||
jq -a -r '.[] | [ .failover.ip, .failover.active_server_ip ] | @csv' <<< $OUT |
|
||||
while read -r line
|
||||
do
|
||||
line=$(sed 's/"//g' <<< $line)
|
||||
IFS=',' read -r -a arr <<< "$line"
|
||||
FOIP=$(dig -x ${arr[0]} +short)
|
||||
HOST=$(dig -x ${arr[1]} +short)
|
||||
printf "%15s %20s => %15s %20s\n" ${arr[0]} ${FOIP::-1} ${arr[1]} ${HOST::-1}
|
||||
done
|
||||
echo
|
||||
echo
|
||||
Reference in New Issue
Block a user