diff --git a/playbooks/gateways.yml b/playbooks/gateways.yml index 015f1e8..f595b30 100755 --- a/playbooks/gateways.yml +++ b/playbooks/gateways.yml @@ -29,3 +29,4 @@ - service-bind-slave - network-routing - system-sysctl-gateway + - service-respondd diff --git a/roles/handlers/handlers/main.yml b/roles/handlers/handlers/main.yml index d91953f..c88c76d 100644 --- a/roles/handlers/handlers/main.yml +++ b/roles/handlers/handlers/main.yml @@ -76,6 +76,12 @@ systemd: name: ffmwu-ip-rules state: restarted + +- name: restart respondd + systemd: + name: "respondd-{{ item.id }}" + state: restarted + with_items: "{{ meshes }}" - name: iptables-restore shell: iptables-restore < /etc/iptables/rules.v4 diff --git a/roles/service-respondd/README.md b/roles/service-respondd/README.md new file mode 100644 index 0000000..e8a5579 --- /dev/null +++ b/roles/service-respondd/README.md @@ -0,0 +1,16 @@ +# Ansible role service-respondd + +Diese Ansible role installiert und konfiguriert die respondd Implementierung `mesh-announce`. +Pro Mesh Netzwerk muss eine `mesh-announce`-Instanz laufen. + +- installiert `mesh-announce` (Github Clone) +- installiert pro Mesh Netzwerk eine systemd unit + +## Benötigte Variablen + +- Dictionary `meshes` +´´´ +meshes: + - id: xx + site_code: # string +´´´ diff --git a/roles/service-respondd/tasks/main.yml b/roles/service-respondd/tasks/main.yml new file mode 100644 index 0000000..3e49feb --- /dev/null +++ b/roles/service-respondd/tasks/main.yml @@ -0,0 +1,26 @@ +--- +- name: clone respondd repo + git: + repo: https://github.com/freifunk-mwu/mesh-announce.git + dest: /home/admin/clones/mesh-announce + version: mwu-respondd + become: false + +- name: write systemd unit files + template: + src: respondd.service.j2 + dest: "/etc/systemd/system/respondd-{{ item.id }}.service" + owner: root + group: root + mode: 0644 + notify: + - reload systemd + - restart respondd + with_items: "{{ meshes }}" + +- name: configure systemd unit files + systemd: + name: "respondd-{{ item.id }}" + enabled: yes + state: started + with_items: "{{ meshes }}" diff --git a/roles/service-respondd/templates/respondd.service.j2 b/roles/service-respondd/templates/respondd.service.j2 new file mode 100644 index 0000000..56789d1 --- /dev/null +++ b/roles/service-respondd/templates/respondd.service.j2 @@ -0,0 +1,10 @@ +[Unit] +Description=respondd instance {{ item.id }} + +[Service] +ExecStart=/home/admin/clones/mesh-announce/respondd.py -i {{ item.id }}BR -b {{ item.id }}BAT -s {{ item.site_code }} -d /home/admin/clones/mesh-announce/ +Restart=always +Environment=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + +[Install] +WantedBy=multi-user.target