Change to super node and exit node in one server

This commit is contained in:
Ansible Admin 2016-01-26 22:58:39 +01:00
parent a422d26a2a
commit ea411cb341
5 changed files with 29 additions and 10 deletions

BIN
.install.sn.yml.swp Normal file

Binary file not shown.

View File

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
# Version 1.5 # Version 1.6
# Parameter setzen # Parameter setzen
GATEWAY1ext=185.66.193.105 GATEWAY1ext=185.66.193.105
GATEWAY2ext=185.66.193.106 GATEWAY2ext=185.66.193.106
@ -24,7 +24,7 @@ if [ $(hostname) = "troisdorf1" ] || [ $(hostname) = "troisdorf2" ]
DEFAULT_GATEWAY=$GATEWAY2 DEFAULT_GATEWAY=$GATEWAY2
DEFAULT_GATEWAYext=$GATEWAY2ext DEFAULT_GATEWAYext=$GATEWAY2ext
FALLBACK_GATEWAY=$GATEWAY1 FALLBACK_GATEWAY=$GATEWAY1
FALLBACK_GATEWAY=$GATEWAY1ext FALLBACK_GATEWAYext=$GATEWAY1ext
DEFAULT_GATEWAYv6=$GATEWAY2v6 DEFAULT_GATEWAYv6=$GATEWAY2v6
FALLBACK_GATEWAYv6=$GATEWAY1v6 FALLBACK_GATEWAYv6=$GATEWAY1v6

View File

@ -2,8 +2,8 @@
# Version 6 # Version 6
# Der servername muss mit einer einstelligen Zahl aufhoeren!!!!! # Der servername muss mit einer einstelligen Zahl aufhoeren!!!!!
communityname="troisdorf" communityname="troisdorf"
#server="troisdorf1 troisdorf2 troisdorf3 troisdorf4 troisdorf5 troisdorf6 troisdorf7 troisdorf8 troisdorf9" server="troisdorf1 troisdorf2 troisdorf3 troisdorf4 troisdorf5 troisdorf6 troisdorf7 troisdorf8 troisdorf9"
server="troisdorf7 {{ sn_hostname }}" #server="troisdorf7 {{ sn_hostname }}"
domain="freifunk-troisdorf.de" domain="freifunk-troisdorf.de"
mtu={{ sn_mtu }} mtu={{ sn_mtu }}
# community MAC address, without the last Byte (:)! # community MAC address, without the last Byte (:)!
@ -55,4 +55,5 @@ $alfred -i bat0 > /dev/null 2>&1 &
/bin/sleep 15 /bin/sleep 15
$batadv -i bat0 -s > /dev/null 2>&1 & $batadv -i bat0 -s > /dev/null 2>&1 &
/usr/sbin/service bind9 restart /usr/sbin/service bind9 restart
/usr/local/sbin/batctl gw client 3 #/usr/local/sbin/batctl gw client 3
/usr/local/sbin/batctl gw server 100Mbit/100Mbit

View File

@ -45,6 +45,12 @@ done
# Allow MAC address spoofing # Allow MAC address spoofing
/sbin/sysctl net.ipv4.conf.bat0.rp_filter=0 /sbin/sysctl net.ipv4.conf.bat0.rp_filter=0
# Create Tunneldigger Bridge
/sbin/brctl addbr br-nodes
/sbin/ip link set dev br-nodes up
/sbin/ebtables -A FORWARD --logical-in br-nodes -j DROP
/usr/local/sbin/batctl if add br-nodes
sleep 5 sleep 5
# stop tunneldigger # stop tunneldigger
@ -65,4 +71,16 @@ sleep 5
/bin/systemctl disable isc-dhcp-server /bin/systemctl disable isc-dhcp-server
/bin/systemctl stop isc-dhcp-server /bin/systemctl stop isc-dhcp-server
# Start tunneldigger
/bin/systemctl restart tunneldigger
/bin/systemctl enable tunneldigger
# radvd restart
/bin/systemctl restart radvd
/bin/systemctl enable radvd
# restart DHCP
/bin/systemctl restart isc-dhcp-server
/bin/systemctl enable isc-dhcp-server
exit 0 exit 0

View File

@ -9,7 +9,7 @@
user: root user: root
gather_facts: False gather_facts: False
vars: vars:
snversion: master_v2.1 snversion: master_v2.9000001_beta
batmanversion: v2015.2 batmanversion: v2015.2
common_required_packages: common_required_packages:
- git - git
@ -71,8 +71,8 @@
raw: "sed -i '/deb cdrom/c\\#' /etc/apt/sources.list" raw: "sed -i '/deb cdrom/c\\#' /etc/apt/sources.list"
- name: Make this server ansible compatible - name: Make this server ansible compatible
raw: "apt-get update && apt-get install python -y" raw: "apt-get update && apt-get install python -y"
- name: Add backport repo to source list #target: /etc/apt/sources.list.d # - name: Add backport repo to source list #target: /etc/apt/sources.list.d
apt_repository: repo='deb http://http.debian.net/debian jessie-backports main' state=present # apt_repository: repo='deb http://http.debian.net/debian jessie-backports main' state=present
- name: Update apt cache - name: Update apt cache
apt: update_cache=yes apt: update_cache=yes
- name: Gathering facts - name: Gathering facts
@ -196,7 +196,7 @@
copy: src=./files/{{ item }} dest=/opt/freifunk owner=root group=root mode=0500 copy: src=./files/{{ item }} dest=/opt/freifunk owner=root group=root mode=0500
with_items: check_gw_script with_items: check_gw_script
register: check_gw register: check_gw
when: sn_exit is undefined # when: sn_exit is undefined
- name: Add cron job with check gateway script - name: Add cron job with check gateway script
cron: name=check_gw job="/opt/freifunk/keepalive.sh > /dev/null 2>&1" user="root" cron: name=check_gw job="/opt/freifunk/keepalive.sh > /dev/null 2>&1" user="root"
when: check_gw.changed when: check_gw.changed
@ -205,7 +205,7 @@
copy: src=./files/{{ item }} dest=/opt/freifunk owner=root group=root mode=0500 copy: src=./files/{{ item }} dest=/opt/freifunk owner=root group=root mode=0500
with_items: tunneld_stats_file with_items: tunneld_stats_file
register: tunneld_stats register: tunneld_stats
when: sn_exit is undefined # when: sn_exit is undefined
- name: Add cron job tunneldigger stats - name: Add cron job tunneldigger stats
cron: name=tunneld_stats job="/opt/freifunk/collectd_td_stat.sh > /dev/null 2>&1" user="root" cron: name=tunneld_stats job="/opt/freifunk/collectd_td_stat.sh > /dev/null 2>&1" user="root"
when: tunneld_stats.changed when: tunneld_stats.changed