summaryrefslogtreecommitdiff
path: root/roles/install_fastd
diff options
context:
space:
mode:
authorNiklas Yann Wettengel <niyawe@niyawe.de>2017-07-03 09:46:42 +0200
committerNiklas Yann Wettengel <niyawe@niyawe.de>2017-07-03 09:46:42 +0200
commitd82f8524972086862f64750f325ba067ea993d86 (patch)
treeaa7634db168da40d108e43c7c30fbce299bdc7ab /roles/install_fastd
parent90a8a597eaa3a008eac946460b5c621eafa8ec62 (diff)
fastd working
Diffstat (limited to 'roles/install_fastd')
-rw-r--r--roles/install_fastd/handlers/main.yml29
-rw-r--r--roles/install_fastd/tasks/main.yml63
-rw-r--r--roles/install_fastd/templates/fastd-api.php.j2 (renamed from roles/install_fastd/files/fastd-api.php)2
-rw-r--r--roles/install_fastd/templates/fastd.conf.j212
-rw-r--r--roles/install_fastd/templates/fastd_up.sh.j214
5 files changed, 62 insertions, 58 deletions
diff --git a/roles/install_fastd/handlers/main.yml b/roles/install_fastd/handlers/main.yml
index e8051bc..01cff4d 100644
--- a/roles/install_fastd/handlers/main.yml
+++ b/roles/install_fastd/handlers/main.yml
@@ -4,7 +4,32 @@
name: fastd@ffmyk.service
state: reloaded
-- name: restart fastd
+- name: restart fastdaw
systemd:
- name: fastd@ffmyk.service
+ name: fastd@ffaw.service
+ state: restarted
+
+- name: restart fastdcoc
+ systemd:
+ name: fastd@ffcoc.service
+ state: restarted
+
+- name: restart fastdems
+ systemd:
+ name: fastd@ffems.service
+ state: restarted
+
+- name: restart fastdko
+ systemd:
+ name: fastd@ffko.service
+ state: restarted
+
+- name: restart fastdmy
+ systemd:
+ name: fastd@ffmy.service
+ state: restarted
+
+- name: restart fastdsim
+ systemd:
+ name: fastd@ffsim.service
state: restarted
diff --git a/roles/install_fastd/tasks/main.yml b/roles/install_fastd/tasks/main.yml
index 4a0a131..8f01e47 100644
--- a/roles/install_fastd/tasks/main.yml
+++ b/roles/install_fastd/tasks/main.yml
@@ -6,77 +6,58 @@
name: fastd
tool: yaourt
-- name: create ffmyk folder
+- name: create site folder
file:
- path: /etc/fastd/ffmyk
+ path: /etc/fastd/ff{{ item.name }}
state: directory
+ with_items: "{{ sites }}"
- name: fastd.conf
template:
src: fastd.conf.j2
- dest: /etc/fastd/ffmyk/fastd.conf
+ dest: /etc/fastd/ff{{ item.name }}/fastd.conf
mode: 0640
- notify: restart fastd
-
-- name: create backbone folder
- file:
- path: /etc/fastd/ffmyk/backbone
- state: directory
-
-- name: add backbone peers
- copy:
- src: '{{ item }}'
- dest: /etc/fastd/ffmyk/backbone/{{ item }}
- with_items:
- - fastd1
- - fastd2
- - fastd3
- - fastd4
- - fastd5
- - fastd6
- - fastd7
- - fastd8
- - fastd9
- - fastd10
- - fastd11
- - fastd12
- - fastd13
- - fastd14
- - fastd15
- notify: reload fastd
+ notify: restart fastd{{ item.name }}
+ with_items: "{{ sites }}"
- name: add fastd bin folder
file:
- path: /etc/fastd/ffmyk/bin
+ path: /etc/fastd/ff{{ item.name }}/bin
state: directory
+ with_items: "{{ sites }}"
- name: add fastd up script
template:
src: fastd_up.sh.j2
- dest: /etc/fastd/ffmyk/bin/up.sh
+ dest: /etc/fastd/ff{{ item.name }}/bin/up.sh
mode: 0744
- notify: restart fastd
+ notify: restart fastd{{ item.name }}
+ with_items: "{{ sites }}"
- name: add fastd peers folder
file:
- path: /etc/fastd/ffmyk/peers
+ path: /etc/fastd/ff{{ item.name }}/peers
state: directory
+ with_items: "{{ sites }}"
- name: add fastd peer api script
- copy:
- src: fastd-api.php
- dest: /etc/fastd/ffmyk/bin/fastd-api.php
+ template:
+ src: fastd-api.php.j2
+ dest: /etc/fastd/ff{{ item.name }}/bin/fastd-api.php
+ with_items: "{{ sites }}"
- name: setup cronjob for fastd-api
cron:
- name: fastd-api
+ name: fastd-api-{{ item.name }}
minute: '*/10'
user: root
cron_file: fastd-api
- job: '/usr/bin/php /etc/fastd/ffmyk/bin/fastd-api.php'
+ job: '/usr/bin/php /etc/fastd/ff{{ item.name }}/bin/fastd-api.php'
+ with_items: "{{ sites }}"
- name: start and enable fastd service
systemd:
- name: fastd@ffmyk.service
+ name: fastd@ff{{ item.name }}.service
enabled: yes
state: started
+ with_items: "{{ sites }}"
diff --git a/roles/install_fastd/files/fastd-api.php b/roles/install_fastd/templates/fastd-api.php.j2
index 98da7a7..7b1fc17 100644
--- a/roles/install_fastd/files/fastd-api.php
+++ b/roles/install_fastd/templates/fastd-api.php.j2
@@ -2,7 +2,7 @@
<?php
//$url = 'http://register.freifunk-myk.de/srvapi.php';
$url = 'https://www.freifunk-myk.de/node/keys';
-$out = '/etc/fastd/ffmyk/peers/';
+$out = '/etc/fastd/ff{{ item.name }}/peers/';
if(!is_dir($out)) die('Output Dir missing');
if(!is_writable($out)) die('Output Dir perms');
diff --git a/roles/install_fastd/templates/fastd.conf.j2 b/roles/install_fastd/templates/fastd.conf.j2
index 9d8a42b..1ec818d 100644
--- a/roles/install_fastd/templates/fastd.conf.j2
+++ b/roles/install_fastd/templates/fastd.conf.j2
@@ -1,18 +1,16 @@
log to syslog level info;
-interface "ffmyk-mesh-vpn";
+interface "vpn{{ item.name }}";
method "salsa2012+gmac";
method "salsa2012+umac";
secure handshakes yes;
-bind any:10000;
+bind any:{{ item.fastd_port1 }};
hide ip addresses yes;
hide mac addresses yes;
mtu 1280;
peer group "clients" {
include peers from "peers";
- peer limit {{ fastd_peer_limit }};
}
-include peers from "backbone";
-secret "{{ fastd_secret }}";
-on up "/etc/fastd/ffmyk/bin/up.sh $INTERFACE";
-status socket "/run/ffmyk.socket";
+secret "{{ item.fastd_secret }}";
+on up "/etc/fastd/ff{{ item.name }}/bin/up.sh $INTERFACE";
+status socket "/run/ff{{ item.name }}1.socket";
diff --git a/roles/install_fastd/templates/fastd_up.sh.j2 b/roles/install_fastd/templates/fastd_up.sh.j2
index 87b71ce..6ab39b0 100644
--- a/roles/install_fastd/templates/fastd_up.sh.j2
+++ b/roles/install_fastd/templates/fastd_up.sh.j2
@@ -1,11 +1,11 @@
#!/bin/bash
-ip link set address {{ fastd_mesh_mac }} dev $1
+ip link set address {{ item.fastd_mesh_mac }} dev $1
ip link set up dev $1
-batctl -m bat0 if add $1
-batctl -m bat0 gw server 1000000/1000000
-batctl -m bat0 it 10000
-batctl -m bat0 mm 1
-echo 128 > /sys/class/net/bat0/mesh/hop_penalty
-netctl start bat0
+batctl -m bat{{ item.name }} if add $1
+batctl -m bat{{ item.name }} gw server 1000000/1000000
+batctl -m bat{{ item.name }} it 10000
+batctl -m bat{{ item.name }} mm 1
+echo 64 > /sys/class/net/bat0/mesh/hop_penalty
+netctl start bat{{ item.name }}
systemctl restart dhcpd4.service
systemctl restart named.service