Kernel 3.x and Alfred is back

This commit is contained in:
Ansible Admin 2015-12-17 11:21:59 +01:00
parent 8d4388b4e1
commit 65454f7ed4
4 changed files with 72 additions and 13 deletions

51
files/alfred.sh.j2 Normal file
View File

@ -0,0 +1,51 @@
#!/bin/sh
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)
meshh_if=$(/bin/cat /sys/class/net/l2tp*/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)
"{{ ul_mesh_MAC }}",
"{{ 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

@ -21,8 +21,10 @@ batctl=/usr/local/sbin/batctl
#done
#ip link set address {{ sn_mesh_MAC }} dev $INTERFACE
ifconfig $INTERFACE hw ether {{ sn_mesh_MAC }}
#ifconfig $INTERFACE hw ether {{ sn_mesh_MAC }}
/bin/ip link set dev $INTERFACE up mtu 1312
/sbin/sysctl net.ipv4.conf.$INTERFACE.rp_filter=0
#/sbin/sysctl net.ipv4.conf.$INTERFACE.rp_filter=0
$batctl if add $INTERFACE
echo "enabled" > /sys/devices/virtual/net/$INTERFACE/batman_adv/no_rebroadcast

View File

@ -3,7 +3,7 @@
communityname="troisdorf"
server="troisdorf0 {{ sn_hostname }}"
domain="freifunk-troisdorf.de"
mtu=1400
mtu=1500
# community MAC address, without the last Byte (:)!
communitymacaddress="a2:8c:ae:6f:f6"
# Network part of the network, without the trailing dot
@ -26,8 +26,8 @@ for i in $server; do
if [ $i != $j ]; 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
/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 address $communitymacaddress:${i#$communityname}${j#$communityname} dev $j
# /sbin/ip link set address $communitymacaddress$:0${localserver#$communityname} dev $j

View File

@ -218,6 +218,12 @@
template: src=./files/named.conf.options.j2 dest=/etc/bind/named.conf.options owner=root group=bind mode=644
- name: Copy radvd config template
template: src=./files/radvd.conf.j2 dest=/etc/radvd.conf owner=radvd group=root mode=0444
- 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: Reboot the server finally
shell: sleep 2 && shutdown -r now "Ansible updates triggered"
async: 1
@ -232,11 +238,11 @@
delay=15
timeout=300
when: tunneldigger.changed
- name: Send notification message via Slack
local_action:
module: slack
token: "{{ slack_token }}"
msg: "{{ inventory_hostname }} completed with branch testing"
channel: "#technik"
username: "Ansible on {{ inventory_hostname }}"
parse: 'none'
# - name: Send notification message via Slack
# local_action:
# module: slack
# token: "{{ slack_token }}"
# msg: "{{ inventory_hostname }} completed with branch testing"
# channel: "#technik"
# username: "Ansible on {{ inventory_hostname }}"
# parse: 'none'