From 49ce07f3c2953f08c3e6aba9da2af3b171e77ffd Mon Sep 17 00:00:00 2001 From: Freifunk Troisdorf Date: Fri, 8 Feb 2019 23:15:57 +0100 Subject: [PATCH] Added yanic and resondd. ISC-DHCP hickup workaround --- files/sn_startup.exit.sh.j2 | 17 ++++++++++++++-- files/sn_startup.local.exit.sh.j2 | 16 +++++++++++++-- install.sn.retry | 1 - install.sn.yml | 34 ++++++++++++++++++++++++++++++- 4 files changed, 62 insertions(+), 6 deletions(-) delete mode 100644 install.sn.retry diff --git a/files/sn_startup.exit.sh.j2 b/files/sn_startup.exit.sh.j2 index 1e53d76..f564ee0 100644 --- a/files/sn_startup.exit.sh.j2 +++ b/files/sn_startup.exit.sh.j2 @@ -1,6 +1,8 @@ #!/bin/sh # Version 1.91 +sleep 5 + 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 }} # Activate IP forwarding @@ -34,10 +36,21 @@ curl -X POST --data-urlencode 'payload={"text": "{{ sn_hostname }} is rebooted", /sbin/ebtables -A FORWARD --logical-in br-nodes -j DROP /usr/local/sbin/batctl if add br-nodes -sleep 5 +/bin/sleep 90 /bin/systemctl restart radvd +/bin/sleep 2 /bin/systemctl retsrat tunneldigger +/bin/sleep 2 /bin/systemctl restart bird +/bin/sleep 2 /bin/systemctl restart bird6 -/bin/systemctl restart isc-dhcp-server +/bin/sleep 2 +/bin/systemctl stop isc-dhcp-server +/bin/sleep 2 +/usr/bin/killall dhcpd +/bin/sleep 2 +/bin/rm /var/run/dhcpd.pid +/bin/sleep 2 +/bin/systemctl start isc-dhcp-server exit 0 + diff --git a/files/sn_startup.local.exit.sh.j2 b/files/sn_startup.local.exit.sh.j2 index bd648ae..b0c8423 100644 --- a/files/sn_startup.local.exit.sh.j2 +++ b/files/sn_startup.local.exit.sh.j2 @@ -1,6 +1,8 @@ #!/bin/sh # Version 1.91 +sleep 5 + 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 }} # Activate IP forwarding @@ -34,10 +36,20 @@ curl -X POST --data-urlencode 'payload={"text": "{{ sn_hostname }} is rebooted", /sbin/ebtables -A FORWARD --logical-in br-nodes -j DROP /usr/local/sbin/batctl if add br-nodes -sleep 5 +/bin/sleep 90 /bin/systemctl restart radvd +/bin/sleep 2 /bin/systemctl retsrat tunneldigger +/bin/sleep 2 /bin/systemctl restart bird +/bin/sleep 2 /bin/systemctl restart bird6 -/bin/systemctl restart isc-dhcp-server +/bin/sleep 2 +/bin/systemctl stop isc-dhcp-server +/bin/sleep 2 +/usr/bin/killall dhcpd +/bin/sleep 2 +/bin/rm /var/run/dhcpd.pid +/bin/sleep 2 +/bin/systemctl start isc-dhcp-server exit 0 diff --git a/install.sn.retry b/install.sn.retry deleted file mode 100644 index c48c4ed..0000000 --- a/install.sn.retry +++ /dev/null @@ -1 +0,0 @@ -7.fftdf.de diff --git a/install.sn.yml b/install.sn.yml index 1a494c2..efead34 100644 --- a/install.sn.yml +++ b/install.sn.yml @@ -9,7 +9,7 @@ user: root gather_facts: False vars: - snversion: master_v3.1.5 + snversion: master_v3.1.6 batmanversion: v2017.4 common_required_packages: - git @@ -48,6 +48,7 @@ - libnetfilter-conntrack-dev - libnfnetlink-dev - speedtest-cli + - ethtool modules_required: - batman-adv - nf_conntrack_netlink @@ -61,6 +62,8 @@ - batdelif.sh tunneldigger_service: - tunneldigger.service + respondd_service: + - respondd_service broker_cfg: - l2tp_broker.cfg authorized_keys: @@ -172,6 +175,8 @@ - name: Copy dhcpd template file template: src=./files/dhcpd.conf.j2 dest=/etc/dhcp/dhcpd.conf owner=root group=root mode=0444 register: dhcpd + - name: Copy dhcpd6 template file + template: src=./files/dhcpd6.conf.j2 dest=/etc/dhcp/dhcpd6.conf owner=root group=root mode=0444 - name: Clone static DHCP config git: repo="{{ static_dhcp_repo }}" dest=/opt/freifunk/static-dhcp when: dhcpd.changed @@ -220,6 +225,33 @@ copy: src=./files/bird-{{ sn_hostname }}.conf dest=/etc/bird/bird.conf owner=bird group=bird mode=0444 - name: Bird configuration copy: src=./files/bird6-{{ sn_hostname }}.conf dest=/etc/bird/bird6.conf owner=bird group=bird mode=0444 + - name: Create Yanic user + user: + name: yanic + comment: "Yanic service user" + - name: Create Yanic folder + file: path=/opt/freifunk/yanic state=directory mode=0755 owner=yanic group=yanic + - name: Copy Yanic config template + template: src=./files/yanic.conf.j2 dest=/etc/yanic.conf owner=yanic group=yanic mode=0444 + - name: Shit go stuff + shell: cd /usr/local && wget https://storage.googleapis.com/golang/go1.9.1.linux-amd64.tar.gz -O go-release-linux-amd64.tar.gz && tar xvf go-release-linux-amd64.tar.gz && rm go-release-linux-amd64.tar.gz + - name: Adjust path for go + lineinfile: + dest: /root/.bashrc + line: "{{ item }}" + with_items: + - export GOPATH=/opt/go + - export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin + - name: Compile go + shell: go get -v -u github.com/Freifunk-Troisdorf/yanic + - name: Copy and enable yanic service + shell: cp /opt/go/src/github.com/Freifunk-Troisdorf/yanic/contrib/init/linux-systemd/yanic.service /lib/systemd/system/yanic.service && systemctl daemon-reload && systemctl enable yanic + - name: Get respondd + git: repo=https://github.com/Freifunk-Troisdorf/mesh-announce.git dest=/opt/mesh-announce + - name: Copy respondd service template + shell: cp /opt/mesh-announce/respondd.service /etc/systemd/system + - name: Enable respondd service + shell: systemctl daemon-reload && systemctl enable respondd - name: Copy Slacktee Config template: src=./files/slacktee.conf.j2 dest=/etc/slacktee.conf owner=root group=root mode=0544 - name: Copy Slacktee