option domain-name "{{stack.domain}}"; option domain-name-servers {% for ns in stack.nameservers %}{{ns}}{% if not loop.last%},{%endif%}{%endfor%}; {% if dhcp.bind_address is defined %} local-address {{dhcp.bind_address}}; {% endif %} default-lease-time 600; max-lease-time 7200; ddns-update-style none; authoritative; class "vms" { match if substring (option vendor-class-identifier, 0, 4) = "SUNW"; } class "pxe" { match if substring (option vendor-class-identifier, 0, 9) = "PXEClient"; } class "ipph" { match if (option vendor-class-identifier = "ccp.avaya.com" or option vendor-class-identifier = "ATA186" or substring (option vendor-class-identifier, 0, 28) = "Cisco Systems, Inc. IP Phone"); } option option-66 code 66 = text; {% if dhcp.network_ranges is defined %} {% for start_net, opts in dhcp.network_ranges.iteritems() %} {% set nets = start_net | net_range_to_list(opts.count) %} {% for n in nets %} {% set addr = n.split('/')[0] %} {% set mask = n|ipaddr('netmask') %} {% set fto = n.split('.')[:3] | join('.') %} {% set range = fto ~ "." ~ opts.ip_range_start ~ " " ~ fto ~ "." ~ opts.ip_range_end %} subnet {{addr}} netmask {{n|ipaddr('netmask')}} { option routers {{fto}}.{{opts.default_last_octet}}; option domain-name-servers {{opts.nameservers|join(',')}}; pool { range {{range}}; } } {% endfor %} {% endfor %} {% endif %} {% if dhcp.networks is defined %} {% for addr,net in dhcp.networks.iteritems() %} {% if net.hosts is defined %} {% for h in net.hosts %} host {{net.vlan}}-{{h.name}} { hardware ethernet {{h.mac}}; fixed-address {{h.ipv4}}; } {% endfor %} {% endif %} subnet {{addr.split('/')[0]}} netmask {{addr|ipaddr('netmask')}} { option routers {{net.default}}; option domain-name-servers {{net.nameservers|join(',')}}; {% if "bootp" in net.keys() %} option option-66 "{{net.bootp.tftp}}/yealink/"; {% endif %} {% if "pxe" in net.keys() %} next-server {{net.pxe['next-server']}}; filename "{{net.pxe.filename}}"; {% endif %} pool { range {{net.range}}; } } {% endfor %} {% endif %}