diff --git a/roles/ffh.mesh_announce/defaults/main.yml b/roles/ffh.mesh_announce/defaults/main.yml new file mode 100644 index 00000000..1f9267ec --- /dev/null +++ b/roles/ffh.mesh_announce/defaults/main.yml @@ -0,0 +1,3 @@ +--- + +mesh_announce_cfg_path: "/etc/mesh-announce" diff --git a/roles/ffh.mesh_announce/tasks/main.yml b/roles/ffh.mesh_announce/tasks/main.yml index baa6f7c8..63ec0cb7 100644 --- a/roles/ffh.mesh_announce/tasks/main.yml +++ b/roles/ffh.mesh_announce/tasks/main.yml @@ -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 @@ -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 diff --git a/roles/ffh.mesh_announce/templates/respondd.conf.j2 b/roles/ffh.mesh_announce/templates/respondd.conf.j2 new file mode 100644 index 00000000..48e259ce --- /dev/null +++ b/roles/ffh.mesh_announce/templates/respondd.conf.j2 @@ -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 %} diff --git a/roles/ffh.mesh_announce/templates/respondd.service.j2 b/roles/ffh.mesh_announce/templates/respondd.service.j2 index 4e60ae70..68c63644 100644 --- a/roles/ffh.mesh_announce/templates/respondd.service.j2 +++ b/roles/ffh.mesh_announce/templates/respondd.service.j2 @@ -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