network/salt/dhcp/dhcpd.conf

18 lines
618 B
ISCdhcpd

{%- import_yaml "netmasks.yaml" as netmasks -%}
{%- for iface, ips in salt['grains.get']('ip_interfaces').items() %}
{%- if iface not in ['core', 'lo'] %}
{%- set conf = pillar['dhcp'][iface] %}
{%- set subnet = pillar['subnets-inet'][iface] %}
subnet {{ subnet.split('/')[0] }} netmask {{ netmasks[subnet.split('/')[1]] }} {
authoritative;
default-lease-time {{ conf['time'] }};
max-lease-time {{ conf['max-time'] }};
range {{ conf['start'] }} {{ conf['end'] }};
{%- for name, value in conf['opts'].items() %}
option {{ name }} {{ value }};
{%- endfor %}
}
{%- endif %}
{%- endfor %}