summaryrefslogtreecommitdiffstats
path: root/roles/network/templates
diff options
context:
space:
mode:
authorAhmed Abdelhalim <[email protected]>2025-09-02 01:30:46 +0200
committerAhmed Abdelhalim <[email protected]>2025-09-02 01:30:46 +0200
commit744d2521ffc1c68fc0328731275c9fc7751f366d (patch)
tree59c829910a6eda6019d8302cb09bbe6604057e55 /roles/network/templates
parent17f10052bdbc4cf5bfd0e2fa335f13c0165284a5 (diff)
Fix pihole and network manger DNS when VPN isn't active
Diffstat (limited to 'roles/network/templates')
-rw-r--r--roles/network/templates/eth0-connection.nmconnection.j24
-rw-r--r--roles/network/templates/wifi-connection.nmconnection.j24
2 files changed, 8 insertions, 0 deletions
diff --git a/roles/network/templates/eth0-connection.nmconnection.j2 b/roles/network/templates/eth0-connection.nmconnection.j2
index dab5a6de..493afdf7 100644
--- a/roles/network/templates/eth0-connection.nmconnection.j2
+++ b/roles/network/templates/eth0-connection.nmconnection.j2
@@ -10,7 +10,9 @@ autoconnect=true
method=manual
addresses={{ network_ipv4_address }}
gateway={{ network_ipv4_gateway }}
+{% if network_ipv4_dns is defined %}
dns={{ network_ipv4_dns }}
+{% endif %}
{% else %}
method=auto
{% endif %}
@@ -21,7 +23,9 @@ addr-gen-mode=default
method=manual
addresses={{ network_ipv6_address }}
gateway={{ network_ipv6_gateway }}
+{% if network_ipv6_dns is defined %}
dns={{ network_ipv6_dns }}
+{% endif %}
{% else %}
method=auto
{% endif %}
diff --git a/roles/network/templates/wifi-connection.nmconnection.j2 b/roles/network/templates/wifi-connection.nmconnection.j2
index c04077c0..0fd69cb1 100644
--- a/roles/network/templates/wifi-connection.nmconnection.j2
+++ b/roles/network/templates/wifi-connection.nmconnection.j2
@@ -18,7 +18,9 @@ psk={{ network_wifi_pass }}
method=manual
addresses={{ network_ipv4_address }}
gateway={{ network_ipv4_gateway }}
+{% if network_ipv4_dns is defined %}
dns={{ network_ipv4_dns }}
+{% endif %}
{% else %}
method=auto
{% endif %}
@@ -29,7 +31,9 @@ addr-gen-mode=default
method=manual
addresses={{ network_ipv6_address }}
gateway={{ network_ipv6_gateway }}
+{% if network_ipv6_dns is defined %}
dns={{ network_ipv6_dns }}
+{% endif %}
{% else %}
method=auto
{% endif %}