From 8c9e5596d17461db0333912b7e33993d9aa2e3f6 Mon Sep 17 00:00:00 2001
From: Nico Boehr <nico@nicoboehr.de>
Date: Sun, 29 Sep 2024 21:14:45 +0200
Subject: [PATCH] add support for peering directly over interfaces

---
 roles/backbone-babel/tasks/main.yml | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/roles/backbone-babel/tasks/main.yml b/roles/backbone-babel/tasks/main.yml
index 00bb123..f94ec04 100644
--- a/roles/backbone-babel/tasks/main.yml
+++ b/roles/backbone-babel/tasks/main.yml
@@ -40,7 +40,17 @@
   ansible.builtin.include_tasks:
     file: loopback.yml
 
-- name: Get all lines in local machine
+- name: Create interface network config for peering interfaces
+  ansible.builtin.template:
+    src: peer.network.j2
+    dest: "/etc/systemd/network/bb-babel-{{ interface }}.network"
+  notify:
+    - reload systemd-networkd
+  loop: "{{ bb_babel_peer_interfaces|default([]) }}"
+  loop_control:
+    loop_var: interface
+
+- name: Get all wireguard lines in local machine
   ansible.builtin.set_fact:
     local_lines: "{{ bb_babel_wg_lines|dict2items|json_query(_query)|items2dict }}"
   vars:
@@ -61,4 +71,4 @@
     file: babeld.yml
   vars:
     # list remote line names for connections we are on either side (line_a or line_b) of
-    interfaces: "{{ bb_babel_wg_connections|selectattr('line_a', 'in', local_lines)|map(attribute='line_b') + bb_babel_wg_connections|selectattr('line_b', 'in', local_lines)|map(attribute='line_a') }}"
+    interfaces: "{{ bb_babel_wg_connections|selectattr('line_a', 'in', local_lines)|map(attribute='line_b') + bb_babel_wg_connections|selectattr('line_b', 'in', local_lines)|map(attribute='line_a') + bb_babel_peer_interfaces|default([]) }}"
-- 
GitLab