Skip to content

Commit

Permalink
Merge pull request #148 from freifunkh/update_mesh-announce
Browse files Browse the repository at this point in the history
Update mesh announce
  • Loading branch information
AiyionPrime authored Feb 14, 2021
2 parents 6ece634 + eec398a commit c995ae6
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 15 deletions.
3 changes: 3 additions & 0 deletions roles/ffh.mesh_announce/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---

mesh_announce_cfg_path: "/etc/mesh-announce"
45 changes: 31 additions & 14 deletions roles/ffh.mesh_announce/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,38 @@
system: yes
generate_ssh_key: yes

- name: create mesh_announce directory
become: true
- name: Create mesh_announce directory
file:
state: directory
dest: /opt/mesh-announce
owner: auto

- name: clone mesh_announce
# repo=https://github.com/ffnord/mesh-announce.git
# change back when https://github.com/ffnord/mesh-announce/pull/64 got merged
- name: Clone mesh_announce
become: yes
become_user: auto
git: >
repo=https://github.com/ffnord/mesh-announce.git
repo=https://github.com/freifunkh/mesh-announce.git
dest=/opt/mesh-announce
accept_hostkey=true
register: code

- name: copy systemd service
become: true
- name: Create configpath
file:
path: "{{ mesh_announce_cfg_path }}"
state: directory

- name: Copy configuration file
template:
src: "respondd.conf.j2"
dest: "{{ mesh_announce_cfg_path }}/respondd.conf"

- name: Copy systemd service
template:
src: "respondd.service.j2"
dest: "/lib/systemd/system/respondd.service"
register: service

- name: Generate firewall config stanza (ferm)
register: ferm_changed
Expand All @@ -49,18 +60,24 @@
notify: reload ferm

- name: Systemd daemon-reload
command: systemctl daemon-reload
when: service.changed
systemd:
daemon_reload: yes

- name: Enable systemd service
command: systemctl enable respondd
systemd:
name: respondd
enabled: yes

- name: Start systemd service
command: systemctl start respondd
systemd:
name: respondd
state: started
register: just_started

- name: restart respondd if something changed
when: code.changed
become: true
service:
name: respondd.service
- name: Restart respondd if something changed
when: not just_started.changed and (code.changed or service.changed)
systemd:
name: respondd
state: restarted

29 changes: 29 additions & 0 deletions roles/ffh.mesh_announce/templates/respondd.conf.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Default settings
[Defaults]
# Listen port
# optional, default: 1001
Port: 1001
# Default link local listen addresses
# optional, default: ff02::2:1001
MulticastLinkAddress: ff02::2:1001
# Default site local listen addresses
# optional, default: ff05::2:1001
MulticastSiteAddress: ff05::2:1001
# Default domain to use
# optional, if specified incoming requests that can not be mapped to a domain
# are mapped to this domain
DefaultDomain: ffh
# Default domain type
# optional, default: simple
# supported domain types are: simple, batadv
DomainType: batadv
# Default ddhcpd IPv4 gateway address
# optional
# IPv4Gateway: 10.116.128.8

{% for domain in domains_with_dom0 | default( [] ) %}
[dom{{ domain.id }}]
BatmanInterface: bat{{ domain.id }}
Interfaces: mesh_fastd_{{ domain.id }}

{% endfor %}
2 changes: 1 addition & 1 deletion roles/ffh.mesh_announce/templates/respondd.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Description=Respondd
After=network.target

[Service]
ExecStart=/opt/mesh-announce/respondd.py -d /opt/mesh-announce/providers {% for domain in domains | default( [] ) %} -i bat{{ domain.id }} -b bat{{ domain.id }} -i mesh_fastd_{{ domain.id }} {% endfor %} -i bat0 -b bat0 -i mesh_fastd
ExecStart=/opt/mesh-announce/respondd.py -d /opt/mesh-announce/providers -f /etc/mesh-announce/respondd.conf
Restart=always
Environment=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

Expand Down

0 comments on commit c995ae6

Please sign in to comment.