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, 12 insertions, 5 deletions
diff --git a/tnet/wg-links-link.yml b/tnet/wg-links-link.yml
index 632024e..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:
@@ -7,10 +16,8 @@
- name: "Make netdev for {{ inventory_hostname }} -> {{ item.key }}"
notify: systemctl restart systemd-networkd
become: yes
- vars:
- if_name: tnet-{{ item.if_name|default(item.key) }}
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
@@ -44,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