summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAhmed Abdelhalim <[email protected]>2026-07-13 17:40:35 +0200
committerAhmed Abdelhalim <[email protected]>2026-07-14 01:23:12 +0200
commit3be508bac52338a5fb95c8582b0b4470bd7a494f (patch)
treeb2dccccbafb90bbd4a81ef772cc7ef6ae05793ce
parent35a4c130750a5bc29655c1767701626ba898b70d (diff)
Configure ipv6/prefer ipv4 switches for network (and all hosts)
-rw-r--r--group_vars/all.ymlbin26 -> 80 bytes
-rw-r--r--group_vars/all.yml.example2
-rw-r--r--host_vars/rpi5.local.ymlbin3629 -> 3602 bytes
-rw-r--r--roles/network/defaults/main.yml1
-rw-r--r--roles/network/meta/argument_specs.yml10
-rw-r--r--roles/network/templates/eth0-connection.nmconnection.j28
-rw-r--r--roles/network/templates/wifi-connection.nmconnection.j26
7 files changed, 22 insertions, 5 deletions
diff --git a/group_vars/all.yml b/group_vars/all.yml
index 20f84e62..65817773 100644
--- a/group_vars/all.yml
+++ b/group_vars/all.yml
Binary files differ
diff --git a/group_vars/all.yml.example b/group_vars/all.yml.example
index ed97d539..9d69dea6 100644
--- a/group_vars/all.yml.example
+++ b/group_vars/all.yml.example
@@ -1 +1,3 @@
---
+network_ipv6_disabled: true
+network_prefer_ipv4: true
diff --git a/host_vars/rpi5.local.yml b/host_vars/rpi5.local.yml
index 83025ca6..27388c7d 100644
--- a/host_vars/rpi5.local.yml
+++ b/host_vars/rpi5.local.yml
Binary files differ
diff --git a/roles/network/defaults/main.yml b/roles/network/defaults/main.yml
index 9497f83f..20776341 100644
--- a/roles/network/defaults/main.yml
+++ b/roles/network/defaults/main.yml
@@ -2,3 +2,4 @@
network_wifi_ssid: ""
network_wifi_pass: ""
network_prefer_ipv4: false
+network_ipv6_disabled: false
diff --git a/roles/network/meta/argument_specs.yml b/roles/network/meta/argument_specs.yml
index 74060d0d..b6c521fe 100644
--- a/roles/network/meta/argument_specs.yml
+++ b/roles/network/meta/argument_specs.yml
@@ -25,6 +25,16 @@ argument_specs:
type: "str"
description: "Static IPv6 default route via router link-local — set when router RA is disabled"
required: false
+ network_prefer_ipv4:
+ type: "bool"
+ description: "Prefer IPv4 over IPv6 for address resolution"
+ required: false
+ default: false
+ network_ipv6_disabled:
+ type: "bool"
+ description: "Disable IPv6 on all network connections"
+ required: false
+ default: false
network_bridge_interface:
type: "str"
description: "Physical NIC to enslave as vmbr0 bridge port"
diff --git a/roles/network/templates/eth0-connection.nmconnection.j2 b/roles/network/templates/eth0-connection.nmconnection.j2
index d6d2ea86..032b18a3 100644
--- a/roles/network/templates/eth0-connection.nmconnection.j2
+++ b/roles/network/templates/eth0-connection.nmconnection.j2
@@ -28,13 +28,13 @@ method=auto
[ipv6]
addr-gen-mode=default
-{% if network_bridge_interface is defined %}
+{% if network_bridge_interface is defined or network_ipv6_disabled %}
method=disabled
-{% else %}
+{% elif network_ipv6_gateway is defined %}
method=auto
-{% if network_ipv6_gateway is defined %}
routes=::/0,{{ network_ipv6_gateway }},100
-{% endif %}
+{% else %}
+method=auto
{% endif %}
[proxy]
diff --git a/roles/network/templates/wifi-connection.nmconnection.j2 b/roles/network/templates/wifi-connection.nmconnection.j2
index 5b4ab185..01dff2eb 100644
--- a/roles/network/templates/wifi-connection.nmconnection.j2
+++ b/roles/network/templates/wifi-connection.nmconnection.j2
@@ -27,9 +27,13 @@ method=auto
[ipv6]
addr-gen-mode=default
+{% if network_ipv6_disabled %}
+method=disabled
+{% elif network_ipv6_gateway is defined %}
method=auto
-{% if network_ipv6_gateway is defined %}
routes=::/0,{{ network_ipv6_gateway }},100
+{% else %}
+method=auto
{% endif %}
[proxy]