diff --git a/bundles/dhcpd/files/dhcpd.conf b/bundles/dhcpd/files/dhcpd.conf index 98ff2b4..8a9e7eb 100644 --- a/bundles/dhcpd/files/dhcpd.conf +++ b/bundles/dhcpd/files/dhcpd.conf @@ -1,27 +1,28 @@ #dhcpd.conf -<% +<% import re %> ddns-update-style none; authoritative; -% for identfier, subnet in dhcp_config.get('subnets', {}).items(): +% for identifier, subnet in dhcp_config.get('subnets', {}).items(): +# subnet '${identifier}' subnet ${subnet['subnet']} netmask ${subnet['netmask']} { -% if subnet.get('range_lower', None) and subnet.get('range_higher', None): +% if subnet.get('range_lower', None) and subnet.get('range_higher', None): range ${subnet['range_lower']} ${subnet['range_higher']}; -% endif +% endif interface "${subnet['interface']}"; default-lease-time ${subnet.get('default-lease-time', 600)}; max-lease-time ${subnet.get('max-lease-time', 3600)}; -% for option, value in sorted(subnet.get('options', {}).items()): - % if re.match('([^0-9\.,\ ])', value): - option ${option} "${value}"; - % else: - option ${option} ${value}; - % endif -% endfor +% for option, value in sorted(subnet.get('options', {}).items()): +% if re.match('([^0-9\.,\ ])', value): + option ${option} "${value}"; +% else: + option ${option} ${value}; +% endif +% endfor } % endfor