Actions
Bug #36036
openPlease add $interface[subnet][prefix]
Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Description
I just set up a puppet class for systemd-networkd, see below
The problem is, the $interface
array doesn't contain prefix. It does have networkmask (/255.255.255.0), but systemd-networkd wants prefix (/24).
$::foreman_interfaces.each |$interface| { if ($interface[primary] == true) { $content = @("EOT") [Match] Name=${interface[identifier]} [Network] Address=${interface[ip]}/${interface[subnet][prefix]} Gateway=${interface[subnet][gateway]} DNS=${interface[subnet][dns_primary]} DNS=${interface[subnet][dns_secondary]} # ${interface} |EOT systemd::network{"${interface[identifier]}.network": content => $content, restart_service => false, } } }
Which results in:
[Match]
Name=eno2
[Network]
Address=10.10.11.224/
Gateway=10.10.10.1
DNS=10.10.10.11
DNS=10.10.10.12
Therefore my kind request to add ${interface[subnet][prefix]}
to the exported variables.
Updated by Han Boetes almost 2 years ago
With some help from bastelfreak @IRC I hacked around the issue like this:
$::foreman_interfaces.each |$interface| { if ($interface[primary] == true) { $prefix = extlib::netmask_to_cidr($interface[subnet][mask]) $content = @("EOT") [Match] Name=${interface[identifier]} [Network] Address=${interface[ip]}/${prefix} Gateway=${interface[subnet][gateway]} DNS=${interface[subnet][dns_primary]} DNS=${interface[subnet][dns_secondary]} # ${interface} |EOT systemd::network{"${interface[identifier]}.network": content => $content, restart_service => false, } } }
But I hope you agree with me having ${interface[subnet][prefix]} would be nicer.
Actions