Mercurial > repos > other > Puppet
changeset 468:8a3c3eb60fdd
Fix IPs on Ubuntu again )hopefully)
We need the "auto" line for each alias.
Also broke it out into separate files, because it's easier
to extend
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 06 Apr 2024 19:01:04 +0100 |
parents | 9ae251433074 |
children | e0147f345e65 |
files | manifests/templates.pp modules/privat/templates/eth0-alias.epp modules/privat/templates/eth0.epp |
diffstat | 3 files changed, 29 insertions(+), 34 deletions(-) [+] |
line wrap: on
line diff
--- a/manifests/templates.pp Sat Mar 23 19:24:00 2024 +0000 +++ b/manifests/templates.pp Sat Apr 06 19:01:04 2024 +0100 @@ -97,13 +97,31 @@ $ipv6_addresses = Integer[1, 10].map |$octet| { "$proxy_4to6_ip_prefix:$octet" } if $operatingsystem == 'Ubuntu' { # Ubuntu can't parse the existing file, so we need to brute-force it with a template - $ipv6_secondaries = join($ipv6_addresses, "\naddress=") - file { "/etc/systemd/network/50-ip-alias.network": - content => "[Network]\naddress=$ipv6_secondaries\n", + file { "/etc/network/interfaces.d/eth0": + content => epp('privat/eth0.epp', + { + default_address => $primary_ip, + gateway_address => $gateway_ip, + } + ), notify => Exec["restart_networking"], } + # …:1 to …:9 for websites, …:10 for mail + Integer[1, 10].each |$octet| { + file { "/etc/network/interfaces.d/eth0:$octet": + content => epp('privat/eth0-alias.epp', + { + prefix_address => $proxy_4to6_ip_prefix, + octet => $octet, + } + ), + notify => Exec["restart_networking"], + } + } } else { + # …:1 to …:9 for websites, …:10 for mail + $ipv6_addresses = Integer[1, 10].map |$octet| { "$proxy_4to6_ip_prefix:$octet" } $ipv6_secondaries = join($ipv6_addresses, " ") augeas {'IPv6 secondary addresses':
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/privat/templates/eth0-alias.epp Sat Apr 06 19:01:04 2024 +0100 @@ -0,0 +1,8 @@ +<%- | + Stdlib::IP::Address::V6 $prefix_address, # Not a whole IP, but looks like one + Integer[0x1,0xFFFF] $octet, +| -%> +auto eth0:<%= $octet %> +iface eth0:<%= $octet %> inet6 static + address <%= $prefix_address %>:<%= $octet %> + netmask 64 \ No newline at end of file
--- a/modules/privat/templates/eth0.epp Sat Mar 23 19:24:00 2024 +0000 +++ b/modules/privat/templates/eth0.epp Sat Apr 06 19:01:04 2024 +0100 @@ -1,7 +1,6 @@ <%- | Stdlib::IP::Address::V6 $default_address, Stdlib::IP::Address::V6 $gateway_address, - Stdlib::IP::Address::V6 $prefix_address, # Not actually an IP, but looks like one | -%> auto eth0 no-auto-down eth0 @@ -9,33 +8,3 @@ address <%= $default_address %> netmask 64 gateway <%= $gateway_address %> -iface eth0:1 inet6 static - address <%= $prefix_address %>:1 - netmask 64 -iface eth0:2 inet6 static - address <%= $prefix_address %>:2 - netmask 64 -iface eth0:3 inet6 static - address <%= $prefix_address %>:3 - netmask 64 -iface eth0:4 inet6 static - address <%= $prefix_address %>:4 - netmask 64 -iface eth0:5 inet6 static - address <%= $prefix_address %>:5 - netmask 64 -iface eth0:6 inet6 static - address <%= $prefix_address %>:6 - netmask 64 -iface eth0:7 inet6 static - address <%= $prefix_address %>:7 - netmask 64 -iface eth0:8 inet6 static - address <%= $prefix_address %>:8 - netmask 64 -iface eth0:9 inet6 static - address <%= $prefix_address %>:9 - netmask 64 -iface eth0:10 inet6 static - address <%= $prefix_address %>:10 - netmask 64