From 8d0cda9e8647d62e6833ac93719ce53441fc77c1 Mon Sep 17 00:00:00 2001 From: Mike Williams <7595658+gaima8@users.noreply.github.com> Date: Tue, 26 Jan 2021 13:04:48 +0000 Subject: [PATCH 1/3] Allow both only IPv6 (no IPv4) and IPv6 DHCP --- README.md | 7 ++++++- templates/ethernet_Debian.j2 | 6 ++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0c2c846..df89965 100644 --- a/README.md +++ b/README.md @@ -238,6 +238,11 @@ ipv6_address: "aaaa:bbbb:cccc:dddd:dead:beef::1/64" ipv6_gateway: "aaaa:bbbb:cccc:dddd::1" ``` +9) You can also do IPv6 DHCP configuration on Ethernet on Debian only +``` +ipv6_bootproto: dhcp +``` + Create a playbook which applies this role to all hosts as shown below, and run the playbook. All the servers should have their network interfaces configured and routed updated. @@ -249,7 +254,7 @@ and routed updated. - role: network ``` -9) This role can also optionally add network interfaces to firewalld zones. The +10) This role can also optionally add network interfaces to firewalld zones. The core firewalld module (http://docs.ansible.com/ansible/latest/firewalld_module.html) can perform the same function, so if you make use of both modules then your playbooks may not be idempotent. Consider this case, where only the firewalld diff --git a/templates/ethernet_Debian.j2 b/templates/ethernet_Debian.j2 index 474486b..0560745 100644 --- a/templates/ethernet_Debian.j2 +++ b/templates/ethernet_Debian.j2 @@ -1,5 +1,6 @@ auto {{ item.device }} +{% if item.ipv6_address is not defined and item.ipv6_bootproto is not defined %} iface {{ item.device }} inet {% if item.bootproto is defined %}{{ item.bootproto }}{% elif item.cidr is defined or item.address is defined %}static{% else %}dhcp{% endif %} {% include 'Debian_ipv4_config.j2' %} @@ -13,9 +14,10 @@ iface {{ item.device }} inet {% if item.bootproto is defined %}{{ item.bootproto {{ option }} {% endfor %} {% endif %} +{% endif %} -{% if item.ipv6_address is defined %} -iface {{ item.device }} inet6 static +{% if item.ipv6_address is defined or item.ipv6_bootproto is defined %} +iface {{ item.device }} inet6 {% if item.ipv6_bootproto is defined %}{{ item.ipv6_bootproto }}{% elif item.ipv6_address is defined %}static{% else %}dhcp{% endif %} {% include 'Debian_ipv6_config.j2' %} {% if item.ipv6_options is defined %} {% for option in item.ipv6_options %} From 7ef8d1490b6502e7e834c9f5a1374be3bf4da9a2 Mon Sep 17 00:00:00 2001 From: Mike Williams <7595658+gaima8@users.noreply.github.com> Date: Tue, 26 Jan 2021 13:16:09 +0000 Subject: [PATCH 2/3] As we have to specify something ipv6_ to get family inet6 the bootproto or address will be defined, so the 'else' is redundant --- templates/ethernet_Debian.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/ethernet_Debian.j2 b/templates/ethernet_Debian.j2 index 0560745..f43c874 100644 --- a/templates/ethernet_Debian.j2 +++ b/templates/ethernet_Debian.j2 @@ -17,7 +17,7 @@ iface {{ item.device }} inet {% if item.bootproto is defined %}{{ item.bootproto {% endif %} {% if item.ipv6_address is defined or item.ipv6_bootproto is defined %} -iface {{ item.device }} inet6 {% if item.ipv6_bootproto is defined %}{{ item.ipv6_bootproto }}{% elif item.ipv6_address is defined %}static{% else %}dhcp{% endif %} +iface {{ item.device }} inet6 {% if item.ipv6_bootproto is defined %}{{ item.ipv6_bootproto }}{% elif item.ipv6_address is defined %}static{% endif %} {% include 'Debian_ipv6_config.j2' %} {% if item.ipv6_options is defined %} {% for option in item.ipv6_options %} From b79ca22ec947646175ba789a2bd58301f6e1c14d Mon Sep 17 00:00:00 2001 From: Mike Williams <7595658+gaima8@users.noreply.github.com> Date: Tue, 26 Jan 2021 13:22:52 +0000 Subject: [PATCH 3/3] Required newline --- templates/ethernet_Debian.j2 | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/ethernet_Debian.j2 b/templates/ethernet_Debian.j2 index f43c874..12a4abf 100644 --- a/templates/ethernet_Debian.j2 +++ b/templates/ethernet_Debian.j2 @@ -18,6 +18,7 @@ iface {{ item.device }} inet {% if item.bootproto is defined %}{{ item.bootproto {% if item.ipv6_address is defined or item.ipv6_bootproto is defined %} iface {{ item.device }} inet6 {% if item.ipv6_bootproto is defined %}{{ item.ipv6_bootproto }}{% elif item.ipv6_address is defined %}static{% endif %} + {% include 'Debian_ipv6_config.j2' %} {% if item.ipv6_options is defined %} {% for option in item.ipv6_options %}