changes to keepalive script

This commit is contained in:
Ansible Admin 2016-01-10 11:43:58 +01:00
parent fce5d81274
commit a11ffec14c
2 changed files with 16 additions and 9 deletions

View File

@ -1,36 +1,43 @@
#!/bin/bash #!/bin/bash
# Version 1.4 # Version 1.5
# Parameter setzen # Parameter setzen
GATEWAY1=185.66.193.105 GATEWAY1ext=185.66.193.105
GATEWAY2=185.66.193.106 GATEWAY2ext=185.66.193.106
GATEWAY1=10.188.255.5
GATEWAY2=10.188.255.6
GATEWAY1v6=2a03:2260:121::255:5 GATEWAY1v6=2a03:2260:121::255:5
GATEWAY2v6=2a03:2260:121::255:6 GATEWAY2v6=2a03:2260:121::255:6
IP=/sbin/ip IP=/sbin/ip
PING=/bin/ping PING=/bin/ping
BATCTL=/usr/local/sbin/batctl BATCTL=/usr/local/sbin/batctl
if [ "hostname = troisdorf1 | troisdorf2" ] #if [ "hostname = troisdorf1 | troisdorf2" ]
if [ $(hostname) = "troisdorf1" ] || [ $(hostname) = "troisdorf2" ]
then then
DEFAULT_GATEWAY=$GATEWAY1 DEFAULT_GATEWAY=$GATEWAY1
DEFAULT_GATEWAYext=$GATEWAY1ext
FALLBACK_GATEWAY=$GATEWAY2 FALLBACK_GATEWAY=$GATEWAY2
FALLBACK_GATEWAYext=$GATEWAY2ext
DEFAULT_GATEWAYv6=$GATEWAY1v6 DEFAULT_GATEWAYv6=$GATEWAY1v6
FALLBACK_GATEWAYv6=$GATEWAY2v6 FALLBACK_GATEWAYv6=$GATEWAY2v6
else else
DEFAULT_GATEWAY=$GATEWAY2 DEFAULT_GATEWAY=$GATEWAY2
DEFAULT_GATEWAYext=$GATEWAY2ext
FALLBACK_GATEWAY=$GATEWAY1 FALLBACK_GATEWAY=$GATEWAY1
DEFAULT_GATEWAYv6=$GATEWAY2v6 FALLBACK_GATEWAY=$GATEWAY1ext
FALLBACK_GATEWAYv6=$GATEWAY1v6 DEFAULT_GATEWAYv6=$GATEWAY2v6
FALLBACK_GATEWAYv6=$GATEWAY1v6
fi fi
if $PING -c 1 $DEFAULT_GATEWAY if $PING -c 1 $DEFAULT_GATEWAYext
then then
$IP route replace default via $DEFAULT_GATEWAY table 42 $IP route replace default via $DEFAULT_GATEWAY table 42
$IP -6 route replace default via $DEFAULT_GATEWAYv6 table 42 $IP -6 route replace default via $DEFAULT_GATEWAYv6 table 42
$BATCTL gw server 100Mbit/100Mbit $BATCTL gw server 100Mbit/100Mbit
echo "Gateway erreichbar" echo "Gateway erreichbar"
else else
if $PING -c 1 $FALLBACK_GATEWAY if $PING -c 1 $FALLBACK_GATEWAYext
then then
$IP route replace default via $FALLBACK_GATEWAY table 42 $IP route replace default via $FALLBACK_GATEWAY table 42
$IP -6 route replace default via $FALLBACK_GATEWAYv6 table 42 $IP -6 route replace default via $FALLBACK_GATEWAYv6 table 42

View File

@ -9,7 +9,7 @@
user: root user: root
gather_facts: False gather_facts: False
vars: vars:
snversion: master_v2.0 snversion: master_v2.1
batmanversion: v2015.2 batmanversion: v2015.2
common_required_packages: common_required_packages:
- git - git