dnsmasq: get DHCP ranges from NetBox

This commit is contained in:
Timotej Lazar 2024-08-05 12:07:39 +02:00
parent 036f7c8b74
commit 6e35a7462d

View file

@ -1,7 +1,9 @@
{% for prefix in prefixes | selectattr('custom_fields.dhcp_server') %}
{% if prefix.custom_fields.dhcp_server.address | ipaddr('address') == primary_ip4 %}
# {{ prefix.vlan.name }}
dhcp-range = set:{{ prefix.vlan.name }},{{ prefix.prefix | ipmath(100) }},{{ prefix.prefix | ipmath(200) }},{{ prefix.prefix | ipaddr('netmask') }}
{% for range in prefix.custom_fields.dhcp_ranges | default([], true) %}
dhcp-range = set:{{ prefix.vlan.name }},{{ range.start_address | ipaddr('address') }},{{ range.end_address | ipaddr('address') }},{{ prefix.prefix | ipaddr('netmask') }}
{% endfor %}
{% if prefix.custom_fields.gateway %}
dhcp-option = tag:{{ prefix.vlan.name }},option:router,{{ prefix.custom_fields.gateway.address | ipaddr('address') }}
{% endif -%}