Role service-yanic: add respondd
This commit is contained in:
parent
07bcfca54d
commit
c728b0509b
10 changed files with 119 additions and 44 deletions
|
@ -5,10 +5,13 @@ Diese Ansible role installiert Yanic.
|
||||||
- legt den Benutzer und Gruppe für Yanic an
|
- legt den Benutzer und Gruppe für Yanic an
|
||||||
- legt das Yanic Verzeichnis aus
|
- legt das Yanic Verzeichnis aus
|
||||||
- legt die InfluxDB Datenbank für Yanic an
|
- legt die InfluxDB Datenbank für Yanic an
|
||||||
|
- kompiliert und installiert Yanic
|
||||||
- schreibt yanic.conf
|
- schreibt yanic.conf
|
||||||
- schreibt yanic.service
|
- schreibt yanic.service
|
||||||
- kompiliert und installiert Yanic
|
- schreibt respondd.conf
|
||||||
|
- schreibt respondd.service
|
||||||
- aktiviert die systemd unit `yanic.service`
|
- aktiviert die systemd unit `yanic.service`
|
||||||
|
- aktiviert die systemd unit `respondd.service`
|
||||||
|
|
||||||
# Benötigte Variablen
|
# Benötigte Variablen
|
||||||
|
|
||||||
|
@ -19,5 +22,6 @@ Diese Ansible role installiert Yanic.
|
||||||
- Variable `yanic_user`
|
- Variable `yanic_user`
|
||||||
- Variable `yanic_home`
|
- Variable `yanic_home`
|
||||||
- Variable `yanic_path`
|
- Variable `yanic_path`
|
||||||
- Variable `yanic_config`
|
|
||||||
- Variable `yanic_database`
|
- Variable `yanic_database`
|
||||||
|
- Variable `yanic_config`
|
||||||
|
- Variable `respondd_config`
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
yanic_user: "yanic"
|
yanic_user: "yanic"
|
||||||
yanic_home: "/var/lib/yanic"
|
yanic_home: "/var/lib/yanic"
|
||||||
yanic_path: "{{ gopath }}/bin/yanic"
|
yanic_path: "{{ gopath }}/bin/yanic"
|
||||||
yanic_config: "/etc/yanic.conf"
|
|
||||||
yanic_database: "yanic"
|
yanic_database: "yanic"
|
||||||
yanic_src: "github.com/FreifunkBremen/yanic"
|
yanic_src: "github.com/FreifunkBremen/yanic"
|
||||||
|
yanic_config: "/etc/yanic.conf"
|
||||||
|
respondd_config: "/etc/respondd.conf"
|
||||||
|
|
|
@ -7,3 +7,8 @@
|
||||||
systemd:
|
systemd:
|
||||||
name: yanic
|
name: yanic
|
||||||
state: restarted
|
state: restarted
|
||||||
|
|
||||||
|
- name: restart respondd
|
||||||
|
systemd:
|
||||||
|
name: respondd
|
||||||
|
state: restarted
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
---
|
---
|
||||||
dependencies:
|
dependencies:
|
||||||
- { role: golang }
|
# - { role: golang }
|
||||||
- { role: service-influxdb }
|
|
||||||
|
|
|
@ -1,62 +1,35 @@
|
||||||
---
|
---
|
||||||
- name: set facts about Yanic
|
- name: create system user
|
||||||
set_fact:
|
|
||||||
yanic_present: yes
|
|
||||||
|
|
||||||
- name: create Yanic system user
|
|
||||||
user:
|
user:
|
||||||
name: "{{ yanic_user }}"
|
name: "{{ yanic_user }}"
|
||||||
home: "{{ yanic_home }}"
|
home: "{{ yanic_home }}"
|
||||||
shell: /bin/false
|
shell: /bin/false
|
||||||
|
|
||||||
- name: create data dir
|
- name: create source directory
|
||||||
file:
|
|
||||||
path: "{{ yanic_home }}/data"
|
|
||||||
state: directory
|
|
||||||
owner: yanic
|
|
||||||
group: yanic
|
|
||||||
mode: 0755
|
|
||||||
|
|
||||||
- name: create database
|
|
||||||
influxdb_database:
|
|
||||||
database_name: "{{ yanic_database }}"
|
|
||||||
|
|
||||||
- name: write Yanic config
|
|
||||||
template:
|
|
||||||
src: "yanic.conf.j2"
|
|
||||||
dest: "{{ yanic_config }}"
|
|
||||||
notify: restart yanic
|
|
||||||
|
|
||||||
- name: create systemd unit for Yanic
|
|
||||||
template:
|
|
||||||
src: "yanic.service.j2"
|
|
||||||
dest: "/etc/systemd/system/yanic.service"
|
|
||||||
notify: reload systemd
|
|
||||||
|
|
||||||
- name: create Yanic source directory
|
|
||||||
file:
|
file:
|
||||||
path: "{{ gopath }}/src/{{ yanic_src }}"
|
path: "{{ gopath }}/src/{{ yanic_src }}"
|
||||||
state: directory
|
state: directory
|
||||||
|
|
||||||
- name: clone Yanic repository
|
- name: clone repository
|
||||||
git:
|
git:
|
||||||
repo: "https://{{ yanic_src }}"
|
repo: "https://{{ yanic_src }}"
|
||||||
dest: "{{ gopath }}/src/{{ yanic_src }}"
|
dest: "{{ gopath }}/src/{{ yanic_src }}"
|
||||||
|
version: respondd
|
||||||
force: true
|
force: true
|
||||||
|
|
||||||
- name: get required library versions
|
- name: ensure dependencies
|
||||||
shell: "cd {{ gopath }}/src/{{ yanic_src }} && {{ gopath }}/bin/dep ensure"
|
shell: "cd {{ gopath }}/src/{{ yanic_src }} && {{ gopath }}/bin/dep ensure"
|
||||||
environment:
|
environment:
|
||||||
GOPATH: "{{ gopath }}"
|
GOPATH: "{{ gopath }}"
|
||||||
|
|
||||||
- name: build Yanic binary
|
- name: build binary
|
||||||
shell: 'go install {{ gopath }}/src/{{ yanic_src }}'
|
shell: 'go install {{ gopath }}/src/{{ yanic_src }}'
|
||||||
environment:
|
environment:
|
||||||
GOPATH: "{{ gopath }}"
|
GOPATH: "{{ gopath }}"
|
||||||
notify: restart yanic
|
|
||||||
|
|
||||||
- name: configure Yanic systemd unit
|
- name: configure yanic
|
||||||
systemd:
|
include_tasks: yanic.yml
|
||||||
name: "yanic.service"
|
when: server_type == "monitoring"
|
||||||
enabled: yes
|
|
||||||
state: started
|
- name: configure respondd
|
||||||
|
include_tasks: respondd.yml
|
||||||
|
|
18
roles/service-yanic/tasks/respondd.yml
Normal file
18
roles/service-yanic/tasks/respondd.yml
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
---
|
||||||
|
- name: write config
|
||||||
|
template:
|
||||||
|
src: "respondd.conf.j2"
|
||||||
|
dest: "{{ respondd_config }}"
|
||||||
|
notify: restart respondd
|
||||||
|
|
||||||
|
- name: create systemd unit
|
||||||
|
template:
|
||||||
|
src: "respondd.service.j2"
|
||||||
|
dest: "/etc/systemd/system/respondd.service"
|
||||||
|
notify: reload systemd
|
||||||
|
|
||||||
|
- name: configure systemd unit
|
||||||
|
systemd:
|
||||||
|
name: "respondd.service"
|
||||||
|
enabled: yes
|
||||||
|
state: started
|
34
roles/service-yanic/tasks/yanic.yml
Normal file
34
roles/service-yanic/tasks/yanic.yml
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
---
|
||||||
|
- name: set facts
|
||||||
|
set_fact:
|
||||||
|
yanic_present: yes
|
||||||
|
|
||||||
|
- name: create data dir
|
||||||
|
file:
|
||||||
|
path: "{{ yanic_home }}/data"
|
||||||
|
state: directory
|
||||||
|
owner: yanic
|
||||||
|
group: yanic
|
||||||
|
mode: 0755
|
||||||
|
|
||||||
|
- name: create database
|
||||||
|
influxdb_database:
|
||||||
|
database_name: "{{ yanic_database }}"
|
||||||
|
|
||||||
|
- name: write config
|
||||||
|
template:
|
||||||
|
src: "yanic.conf.j2"
|
||||||
|
dest: "{{ yanic_config }}"
|
||||||
|
notify: restart yanic
|
||||||
|
|
||||||
|
- name: create systemd unit
|
||||||
|
template:
|
||||||
|
src: "yanic.service.j2"
|
||||||
|
dest: "/etc/systemd/system/yanic.service"
|
||||||
|
notify: reload systemd
|
||||||
|
|
||||||
|
- name: configure systemd unit
|
||||||
|
systemd:
|
||||||
|
name: "yanic.service"
|
||||||
|
enabled: yes
|
||||||
|
state: started
|
20
roles/service-yanic/templates/respondd.conf.j2
Normal file
20
roles/service-yanic/templates/respondd.conf.j2
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
data_interval = "1m"
|
||||||
|
|
||||||
|
batman = [ {% for mesh in meshes %}"{{mesh.id}}bat"{% if not loop.last %}, {% endif %}{% endfor %}]
|
||||||
|
|
||||||
|
[[listen]]
|
||||||
|
address = "ff05::2:1001"
|
||||||
|
interface = "dom0br"
|
||||||
|
port = 1001
|
||||||
|
|
||||||
|
[defaults]
|
||||||
|
node_id = ""
|
||||||
|
hostname = ""
|
||||||
|
site_code = "ffmwu"
|
||||||
|
domain_code = "servers"
|
||||||
|
{% if server_type == "gateway" %}
|
||||||
|
vpn = true
|
||||||
|
{% else %}
|
||||||
|
vpn = false
|
||||||
|
{% endif %}
|
||||||
|
traffic_interfaces = [ "{{ ansible_default_ipv4.interface }}" ]
|
15
roles/service-yanic/templates/respondd.service.j2
Normal file
15
roles/service-yanic/templates/respondd.service.j2
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
[Unit]
|
||||||
|
Description=respondd
|
||||||
|
Documentation=https://github.com/FreifunkBremen/yanic
|
||||||
|
Wants=network-online.target
|
||||||
|
After=network-online.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
|
||||||
|
ExecStart={{ yanic_path }} respondd --config {{ respondd_config }}
|
||||||
|
Restart=always
|
||||||
|
RestartSec=5s
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
|
@ -25,6 +25,12 @@ domains = [
|
||||||
{% for mesh in meshes %}
|
{% for mesh in meshes %}
|
||||||
[[respondd.interfaces]]
|
[[respondd.interfaces]]
|
||||||
ifname = "{{mesh.id}}br"
|
ifname = "{{mesh.id}}br"
|
||||||
|
{% if mesh.legacy is defined %}
|
||||||
|
ip_address = "{{ 'fe80::1:aff:fe%02x:%02x' % (mesh.domain_number, magic) }}"
|
||||||
|
{% else %}
|
||||||
|
ip_address = "{{ 'fe80::1:aff:fe56:%0x%03x' % (mesh.domain_number, magic) }}"
|
||||||
|
{% endif %}
|
||||||
|
multicast_address = "ff05::2:1001"
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
[nodes]
|
[nodes]
|
||||||
|
|
Loading…
Reference in a new issue