aboutsummaryrefslogtreecommitdiff
path: root/tnet/wg-links-link.yml
diff options
context:
space:
mode:
Diffstat (limited to 'tnet/wg-links-link.yml')
-rw-r--r--tnet/wg-links-link.yml17
1 files changed, 13 insertions, 4 deletions
diff --git a/tnet/wg-links-link.yml b/tnet/wg-links-link.yml
index 6f1bb87..c1c520b 100644
--- a/tnet/wg-links-link.yml
+++ b/tnet/wg-links-link.yml
@@ -1,3 +1,12 @@
+- set_fact:
+ if_name: tnet-{{ item.value.if_name|default(item.key) }}
+
+#- debug:
+# msg: |
+# if_name {{ if_name }}
+# item.value.if_name {{ item.value.if_name|default("NOT SET") }}
+# item.key {{ item.key }}
+
- notify: systemctl restart systemd-networkd
become: yes
file:
@@ -8,13 +17,13 @@
notify: systemctl restart systemd-networkd
become: yes
copy:
- dest: "/etc/systemd/network/50-tnet-{{ item.key }}.netdev"
+ dest: "/etc/systemd/network/50-{{ if_name }}.netdev"
owner: systemd-network
group: adm
mode: 0640
content: |
[NetDev]
- Name=tnet-{{ item.key }}
+ Name={{ if_name }}
Kind=wireguard
Description=tnet link to {{ item.key }}
@@ -42,12 +51,12 @@
notify: systemctl restart systemd-networkd
become: yes
copy:
- dest: "/etc/systemd/network/50-tnet-{{ item.key }}.network"
+ dest: "/etc/systemd/network/50-{{ if_name }}.network"
owner: systemd-network
group: adm
content: |
[Match]
- Name=tnet-{{ item.key }}
+ Name={{ if_name }}
[Network]
Address={{ item.value.address }}/64