ddns-update-style none; allow booting; allow bootp; log-facility local7; authoritative; shared-network all-networks { {% for dhcp in default_dhcp_list %} subnet {{ dhcp.subnet }} netmask {{ dhcp.netmask }} { option routers {{ dhcp.gateway }}; option domain-name-servers {{ dhcp.dns }}; option subnet-mask {{ dhcp.netmask }}; {% if dhcp.default_lease_time is defined and dhcp.default_lease_time > 0 %} default-lease-time {{ dhcp.default_lease_time }}; {% else %} default-lease-time {{ dhcp_default_lease_time }}; {% endif %} {% if dhcp.max_lease_time is defined and dhcp.max_lease_time > 0 %} max-lease-time {{ dhcp.max_lease_time }}; {% else %} max-lease-time {{ dhcp_max_lease_time }}; {% endif %} {% if dhcp.tftp_server is defined and dhcp.tftp_server | ipaddr %} next-server {{ dhcp.tftp_server }}; {% elif default_tftp_server is defined and default_tftp_server | length > 0 %} next-server {{ default_tftp_server }}; {% endif %} {% if dhcp.tftp_boot_path is defined and dhcp.tftp_boot_path | ipaddr %} filename "{{ dhcp.tftp_boot_path }}"; {% elif default_tftp_boot_path is defined and default_tftp_boot_path | length > 0 %} filename "{{ default_tftp_boot_path }}"; {% endif %} } {% endfor %} group { {% for item in groups['pxe_servers'] %} host {{ hostvars[item]['server_hostname'] }} { hardware ethernet {{ hostvars[item]['server_mac_address'] | upper }}; fixed-address {{ hostvars[item]['server_fixed_addr'] }}; option host-name "{{ hostvars[item]['server_hostname'] }}"; } {% endfor %} } }