Minor fixes

This commit is contained in:
Ansible Admin 2015-12-14 20:07:50 +01:00
parent b08a586d1b
commit 51cc01a485
4 changed files with 14 additions and 63 deletions

View File

@ -1,50 +0,0 @@
#!/bin/sh
exit 0
release=$(/bin/uname -r)
nodeid=$( /bin/echo {{ sn_mesh_MAC }} | /bin/sed s/://g)
meshh_if=$(/bin/cat /sys/class/net/troisdorf*/address | /bin/grep -v ^00:00:00)
tempfile=/tmp/alfred_info
if [ -f $tempfile ]
then
/bin/rm $tempfile
fi
/bin/cat > $tempfile <<EOF
{
"network": {
"mac": "{{ sn_mesh_MAC }}",
"addresses": [
"{{ sn_mesh_IPv6 }}",
"{{ sn_mesh_IPv4 }}"
],
"mesh_interfaces": [
$(for i in $meshh_if; do /bin/echo '"'$i'",';done)
"{{ sn_mesh_MAC }}"
]
},
"vpn": true,
"node_id": "$nodeid",
"hostname": "Gateway:{{ sn_hostname }}",
"hardware": {
"model": "vServer"
},
"owner": {
"contact": "stefan@freifunk-troisdorf.de"
}
}
EOF
if [ -f $tempfile ]
then
/bin/cat "$tempfile" | /bin/gzip | /usr/local/sbin/alfred -s 158
fi
if [ -f $tempfile ]
then
/bin/rm $tempfile
fi
exit 0

View File

@ -1,9 +1,9 @@
#!/bin/sh #!/bin/sh
# Server name ending must be a single digit number # Server name ending must be a single digit number
communityname="troisdorf" communityname="troisdorf"
server="troisdorf1 troisdorf2 troisdorf3 troisdorf4 troisdorf5 troisdorf6 troisdorf9" server="troisdorf0 {{ sn_hostname }}"
domain="freifunk-troisdorf.de" domain="freifunk-troisdorf.de"
mtu=1500 mtu=1400
# community MAC address, without the last Byte (:)! # community MAC address, without the last Byte (:)!
communitymacaddress="a2:8c:ae:6f:f6" communitymacaddress="a2:8c:ae:6f:f6"
# Network part of the network, without the trailing dot # Network part of the network, without the trailing dot
@ -26,9 +26,12 @@ for i in $server; do
if [ $i != $j ]; then if [ $i != $j ]; then
if [ $i = $(/bin/hostname) ]; then if [ $i = $(/bin/hostname) ]; then
/sbin/ip link add $j type gretap local $(/bin/hostname -I | /usr/bin/cut -f1 -d' ') remote $(/usr/bin/dig +short $j.$domain) dev eth0 nopmtudisc # /sbin/ip link add $j type gretap local $(/bin/hostname -I | /usr/bin/cut -f1 -d' ') remote $(/usr/bin/dig +short $j.$domain) dev eth0 nopmtudisc
/sbin/ip link add $j type gretap local $(/bin/hostname -I | /usr/bin/cut -f1 -d' ') remote $(/usr/bin/dig +short $j.$domain) dev eth0
/sbin/ip link set dev $j mtu $mtu /sbin/ip link set dev $j mtu $mtu
/sbin/ip link set address $communitymacaddress:${i#$communityname}${j#$communityname} dev $j # /sbin/ip link set address $communitymacaddress:${i#$communityname}${j#$communityname} dev $j
# /sbin/ip link set address $communitymacaddress$:0${localserver#$communityname} dev $j
/sbin/ip link set address $communitymacaddress$:${localserver#$communityname}0 dev $j
/sbin/ip link set $j up /sbin/ip link set $j up
$batctl if add $j $batctl if add $j
fi fi

View File

@ -3,7 +3,7 @@
curl -X POST --data-urlencode 'payload={"text": "{{ sn_hostname }} is rebooted", "channel": "#technik", "username": "{{ sn_hostname }}", "icon_emoji": ":floppy_disk:"}' https://hooks.slack.com/services/{{ slack_token }} curl -X POST --data-urlencode 'payload={"text": "{{ sn_hostname }} is rebooted", "channel": "#technik", "username": "{{ sn_hostname }}", "icon_emoji": ":floppy_disk:"}' https://hooks.slack.com/services/{{ slack_token }}
# Stop tunneldigger until bat0 is up # Stop tunneldigger until bat0 is up
#/usr/sbin/service tunneldigger stop /usr/sbin/service tunneldigger stop
# Set unreachable for table 200 # Set unreachable for table 200
#/bin/ip route add unreachable 0.0.0.0/0 table iffy #/bin/ip route add unreachable 0.0.0.0/0 table iffy
@ -38,10 +38,15 @@ curl -X POST --data-urlencode 'payload={"text": "{{ sn_hostname }} is rebooted",
# Set gateway for table 200 # Set gateway for table 200
#/bin/ip route replace default via {{ sn_iffy_traffic }} table iffy #/bin/ip route replace default via {{ sn_iffy_traffic }} table iffy
sleep 5
# Start tunneldigger # Start tunneldigger
/usr/sbin/service tunneldigger restart /usr/sbin/service tunneldigger restart
# radvd restart # radvd restart
/usr/sbin/service radvd restart /usr/sbin/service radvd restart
# restart DHCP
/usr/sbin/service isc-dhcp-server restart
exit 0 exit 0

View File

@ -55,8 +55,6 @@
- named.conf.fftdf - named.conf.fftdf
check_gw_script: check_gw_script:
- keepalive.sh - keepalive.sh
backbone_script:
- gre_backbone.sh
authorized_keys: authorized_keys:
- authorized_keys - authorized_keys
logrotate_config: logrotate_config:
@ -199,8 +197,7 @@
- name: Add cron startup script - name: Add cron startup script
cron: name=startup special_time=reboot job="/opt/freifunk/sn_startup.sh" cron: name=startup special_time=reboot job="/opt/freifunk/sn_startup.sh"
- name: Copy backbone script - name: Copy backbone script
copy: src=./files/{{ item }} dest=/opt/freifunk owner=root group=root mode=0500 template: src=./files/gre_backbone.sh.j2 dest=/opt/freifunk/gre_backbone.sh owner=root group=root mode=0544
with_items: backbone_script
- name: Collectd template file - name: Collectd template file
template: src=./files/collectd.conf.j2 dest=/etc/collectd/collectd.conf owner=root group=root mode=0444 template: src=./files/collectd.conf.j2 dest=/etc/collectd/collectd.conf owner=root group=root mode=0444
register: collectd register: collectd
@ -235,10 +232,6 @@
delay=15 delay=15
timeout=300 timeout=300
when: tunneldigger.changed when: tunneldigger.changed
- name: Alfed message
template: src=./files/alfred.sh.j2 dest=/opt/freifunk/alfred.sh owner=root group=root mode=0544
- name: Add cron job with alfred info script
cron: name=alfred_info job="/opt/freifunk/alfred.sh > /dev/null 2>&1" user="root"
- name: Send notification message via Slack - name: Send notification message via Slack
local_action: local_action:
module: slack module: slack