From 09fbb2b1d86b8ad6671c746f3df997390f7a6293 Mon Sep 17 00:00:00 2001 From: Ahmed Abdelhalim Date: Mon, 6 Jul 2026 01:49:45 +0200 Subject: Fix pve network setup --- roles/network/templates/bridge.nmconnection.j2 | 29 ++++++++++++++++++++++ .../templates/eth0-connection.nmconnection.j2 | 12 +++++++-- 2 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 roles/network/templates/bridge.nmconnection.j2 (limited to 'roles/network/templates') diff --git a/roles/network/templates/bridge.nmconnection.j2 b/roles/network/templates/bridge.nmconnection.j2 new file mode 100644 index 00000000..2e8bf23c --- /dev/null +++ b/roles/network/templates/bridge.nmconnection.j2 @@ -0,0 +1,29 @@ +[connection] +id={{ network_bridge }} +type=bridge +interface-name={{ network_bridge }} +autoconnect=true + +[bridge] +stp=false + +[ipv4] +method=manual +addresses={{ network_ipv4_address }}/{{ network_ipv4_prefix | default(24) }} +gateway={{ network_ipv4_gateway }} +{% if network_ipv4_dns is defined %} +dns={{ network_ipv4_dns }} +{% endif %} + +[ipv6] +addr-gen-mode=default +{% if network_ipv6_address is defined %} +method=manual +addresses={{ network_ipv6_address }} +gateway={{ network_ipv6_gateway }} +{% if network_ipv6_dns is defined %} +dns={{ network_ipv6_dns }} +{% endif %} +{% else %} +method=disabled +{% endif %} diff --git a/roles/network/templates/eth0-connection.nmconnection.j2 b/roles/network/templates/eth0-connection.nmconnection.j2 index 666b0360..6a6481c4 100644 --- a/roles/network/templates/eth0-connection.nmconnection.j2 +++ b/roles/network/templates/eth0-connection.nmconnection.j2 @@ -2,12 +2,18 @@ id=ethernet type=ethernet autoconnect=true +{% if network_bridge is defined %} +controller={{ network_bridge }} +port-type=bridge +{% endif %} [ethernet] cloned-mac-address=permanent [ipv4] -{% if network_ipv4_address is defined %} +{% if network_bridge is defined %} +method=disabled +{% elif network_ipv4_address is defined %} method=manual addresses={{ network_ipv4_address }} gateway={{ network_ipv4_gateway }} @@ -20,7 +26,9 @@ method=auto [ipv6] addr-gen-mode=default -{% if network_ipv6_address is defined %} +{% if network_bridge is defined %} +method=disabled +{% elif network_ipv6_address is defined %} method=manual addresses={{ network_ipv6_address }} gateway={{ network_ipv6_gateway }} -- cgit v1.2.3