ansible/roles/dhcpd/templates/dhcpd.conf.print.j2
Timo Makinen ea3c05c2b5 dhcpd: Move host declarations to global section
No need to set host declarations in subnet or shared-network since
they are always global and it gives warning during startup:

WARNING: Host declarations are global.  They are not limited to the scope you declared them in.
2025-06-13 13:50:03 +00:00

38 lines
1 KiB
Django/Jinja

authorative;
ddns-update-style none;
# logging
on commit {
log(info,
concat("Client ",
binary-to-ascii(16, 8, ":", substring(hardware, 1, 6)),
" requests ",
binary-to-ascii(16, 8, ":", option dhcp-parameter-request-list),
" - ",
pick-first-value(option vendor-class-identifier, "no vendor-id"),
" - ",
pick-first-value(option user-class, "no user-class"))
);
}
shared-network PRINTNET {
subnet 172.20.24.0 netmask 255.255.255.0 {
default-lease-time 86400;
max-lease-time 604800;
option subnet-mask 255.255.255.0;
option broadcast-address 172.20.24.255;
option domain-name "print.foo.sh";
option domain-name-servers 172.20.24.1, 172.20.24.2, 172.20.24.3;
use-host-decl-names on;
}
}
{% for host in ldap_hosts.results %}
host {{ host['cn'] }} {
option host-name "{{ host['cn'] }}";
hardware ethernet {{ host['macAddress'] }};
fixed-address {{ host['ipHostNumber'] }};
}
{% endfor %}