From 1c7be4b8227cde8141227549403b5b04ea371c34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20M=C3=A4user?= Date: Sun, 4 Feb 2018 18:32:45 +0100 Subject: [PATCH] Added batman-adv-dkms build option --- host_vars/gw11.regensburg.freifunk.net | 2 + host_vars/gw21.regensburg.freifunk.net | 2 + host_vars/gw31.regensburg.freifunk.net | 2 + roles/batman/tasks/main.yml | 63 +++++++++++++++++++- roles/mesh-interfaces/tasks/main.yml | 4 +- roles/mesh-interfaces/templates/mesh.conf.j2 | 1 + 6 files changed, 71 insertions(+), 3 deletions(-) diff --git a/host_vars/gw11.regensburg.freifunk.net b/host_vars/gw11.regensburg.freifunk.net index 6fb8343..df0bdeb 100644 --- a/host_vars/gw11.regensburg.freifunk.net +++ b/host_vars/gw11.regensburg.freifunk.net @@ -2,6 +2,8 @@ batman_ipv4: 10.90.32.11/19 batman_ipv6: fdef:f10f:1337:cafe::11/64 +batman_dkms: false +batman_algo: BATMAN_IV global_ipv6: 2a00:9d80:6000:0101::11/64 nextnode4: 10.90.32.1 nextnode6: fdef:f10f:1337:cafe::1 diff --git a/host_vars/gw21.regensburg.freifunk.net b/host_vars/gw21.regensburg.freifunk.net index 27c935e..b225379 100644 --- a/host_vars/gw21.regensburg.freifunk.net +++ b/host_vars/gw21.regensburg.freifunk.net @@ -2,6 +2,8 @@ batman_ipv4: 10.90.64.21/19 batman_ipv6: fdef:f20f:1337:cafe::21/64 +batman_dkms: true +batman_algo: BATMAN_IV global_ipv6: 2a00:9d80:6000:0102::21/64 nextnode4: 10.90.64.1 nextnode6: fdef:f20f:1337:cafe::1 diff --git a/host_vars/gw31.regensburg.freifunk.net b/host_vars/gw31.regensburg.freifunk.net index 2b378be..6b367d4 100644 --- a/host_vars/gw31.regensburg.freifunk.net +++ b/host_vars/gw31.regensburg.freifunk.net @@ -2,6 +2,8 @@ batman_ipv4: 10.90.96.31/19 batman_ipv6: fdef:f30f:1337:cafe::31/64 +batman_dkms: true +batman_algo: BATMAN_V global_ipv6: 2a00:9d80:6000:0103::31/64 nextnode4: 10.90.96.1 nextnode6: fdef:f30f:1337:cafe::1 diff --git a/roles/batman/tasks/main.yml b/roles/batman/tasks/main.yml index af86b3d..fe98b01 100644 --- a/roles/batman/tasks/main.yml +++ b/roles/batman/tasks/main.yml @@ -1,8 +1,69 @@ --- -- name: Install batctl +- name: Install batctl from apt + when: batman_dkms == false apt: name=batctl state=latest +- name: Install dependencies for building DKMS + when: batman_dkms == true + apt: name={{ item }} + with_items: + - ruby + - ruby-dev + - build-essential + - curl + - dkms + - pkgconf + - libnl-genl-3-dev + - linux-headers-{{ ansible_kernel }} + +- name: Install Ruby GEM + when: batman_dkms == true + gem: name=fpm-cookery + +- name: Cloning FFNW Repo + when: batman_dkms == true + git: repo=https://git.ffnw.de/ffnw-server/ffnw-debian + dest=/opt/ffnw-debian + recursive=yes + force=yes + +- name: Cook batman-adv-dkms + command: /usr/local/bin/fpm-cook + args: + chdir: /opt/ffnw-debian/batman-adv-dkms + +- name: Get cooked Debian Packages to List + shell: "find *.deb" + register: pkg_list + args: + chdir: /opt/ffnw-debian/batman-adv-dkms/pkg + +- name: Install batman-adv-dkms + command: "/usr/bin/dpkg -i {{ item }}" + args: + chdir: /opt/ffnw-debian/batman-adv-dkms/pkg + with_items: + - "{{ pkg_list.stdout_lines }}" + +- name: Cook batctl + command: /usr/local/bin/fpm-cook + args: + chdir: /opt/ffnw-debian/batctl + +- name: Get cooked Debian Packages to List + shell: "find *.deb" + register: pkg_list + args: + chdir: /opt/ffnw-debian/batctl/pkg + +- name: Install batctl + command: "/usr/bin/dpkg -i {{ item }}" + args: + chdir: /opt/ffnw-debian/batctl/pkg + with_items: + - "{{ pkg_list.stdout_lines }}" + - name: Enable batman during boot lineinfile: dest=/etc/modules line=batman-adv diff --git a/roles/mesh-interfaces/tasks/main.yml b/roles/mesh-interfaces/tasks/main.yml index 72eb925..93d89ca 100644 --- a/roles/mesh-interfaces/tasks/main.yml +++ b/roles/mesh-interfaces/tasks/main.yml @@ -10,9 +10,9 @@ apt: name=ifupdown state=absent - name: Configure mesh interfaces - template: src=mesh.conf.j2 dest=/etc/network/interfaces.d/mesh.conf + template: src=mesh.conf.j2 dest=/etc/network/interfaces.d/mesh.conf backup=yes notify: Reload interfaces - name: Configure backbone interfaces - template: src=backbone.conf.j2 dest=/etc/network/interfaces.d/backbone.conf + template: src=backbone.conf.j2 dest=/etc/network/interfaces.d/backbone.conf backup=yes notify: Reload interfaces diff --git a/roles/mesh-interfaces/templates/mesh.conf.j2 b/roles/mesh-interfaces/templates/mesh.conf.j2 index 74649cc..8a1e876 100644 --- a/roles/mesh-interfaces/templates/mesh.conf.j2 +++ b/roles/mesh-interfaces/templates/mesh.conf.j2 @@ -27,6 +27,7 @@ iface bat-{{ site_code }} # up /usr/sbin/batctl -m bat-{{ site_code }} gw_mode server 100000 100000 up /usr/sbin/batctl -m bat-{{ site_code }} it 5000 + up /usr/sbin/batctl -m bat-{{ site_code }} ra {{ batman_algo }} # dmy-{{ site_code }} auto dmy-{{ site_code }}