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 das Yanic Verzeichnis aus
|
||||
- legt die InfluxDB Datenbank für Yanic an
|
||||
- kompiliert und installiert Yanic
|
||||
- schreibt yanic.conf
|
||||
- schreibt yanic.service
|
||||
- kompiliert und installiert Yanic
|
||||
- schreibt respondd.conf
|
||||
- schreibt respondd.service
|
||||
- aktiviert die systemd unit `yanic.service`
|
||||
- aktiviert die systemd unit `respondd.service`
|
||||
|
||||
# Benötigte Variablen
|
||||
|
||||
|
@ -19,5 +22,6 @@ Diese Ansible role installiert Yanic.
|
|||
- Variable `yanic_user`
|
||||
- Variable `yanic_home`
|
||||
- Variable `yanic_path`
|
||||
- Variable `yanic_config`
|
||||
- Variable `yanic_database`
|
||||
- Variable `yanic_config`
|
||||
- Variable `respondd_config`
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
yanic_user: "yanic"
|
||||
yanic_home: "/var/lib/yanic"
|
||||
yanic_path: "{{ gopath }}/bin/yanic"
|
||||
yanic_config: "/etc/yanic.conf"
|
||||
yanic_database: "yanic"
|
||||
yanic_src: "github.com/FreifunkBremen/yanic"
|
||||
yanic_config: "/etc/yanic.conf"
|
||||
respondd_config: "/etc/respondd.conf"
|
||||
|
|
|
@ -7,3 +7,8 @@
|
|||
systemd:
|
||||
name: yanic
|
||||
state: restarted
|
||||
|
||||
- name: restart respondd
|
||||
systemd:
|
||||
name: respondd
|
||||
state: restarted
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- { role: golang }
|
||||
- { role: service-influxdb }
|
||||
# - { role: golang }
|
||||
|
|
|
@ -1,62 +1,35 @@
|
|||
---
|
||||
- name: set facts about Yanic
|
||||
set_fact:
|
||||
yanic_present: yes
|
||||
|
||||
- name: create Yanic system user
|
||||
- name: create system user
|
||||
user:
|
||||
name: "{{ yanic_user }}"
|
||||
home: "{{ yanic_home }}"
|
||||
shell: /bin/false
|
||||
|
||||
- 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 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
|
||||
- name: create source directory
|
||||
file:
|
||||
path: "{{ gopath }}/src/{{ yanic_src }}"
|
||||
state: directory
|
||||
|
||||
- name: clone Yanic repository
|
||||
- name: clone repository
|
||||
git:
|
||||
repo: "https://{{ yanic_src }}"
|
||||
dest: "{{ gopath }}/src/{{ yanic_src }}"
|
||||
version: respondd
|
||||
force: true
|
||||
|
||||
- name: get required library versions
|
||||
- name: ensure dependencies
|
||||
shell: "cd {{ gopath }}/src/{{ yanic_src }} && {{ gopath }}/bin/dep ensure"
|
||||
environment:
|
||||
GOPATH: "{{ gopath }}"
|
||||
|
||||
- name: build Yanic binary
|
||||
- name: build binary
|
||||
shell: 'go install {{ gopath }}/src/{{ yanic_src }}'
|
||||
environment:
|
||||
GOPATH: "{{ gopath }}"
|
||||
notify: restart yanic
|
||||
|
||||
- name: configure Yanic systemd unit
|
||||
systemd:
|
||||
name: "yanic.service"
|
||||
enabled: yes
|
||||
state: started
|
||||
- name: configure yanic
|
||||
include_tasks: yanic.yml
|
||||
when: server_type == "monitoring"
|
||||
|
||||
- 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 %}
|
||||
[[respondd.interfaces]]
|
||||
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 %}
|
||||
|
||||
[nodes]
|
||||
|
|
Loading…
Reference in a new issue