dhcpd.conf.j2 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. # {{ ansible_managed }}
  2. #
  3. # DHCP Server Configuration file.
  4. # see /usr/share/doc/dhcp*/dhcpd.conf.example
  5. # see dhcpd.conf(5) man page
  6. #
  7. authoritative;
  8. default-lease-time 43200; # 12 hours
  9. max-lease-time 86400; # 24 hours
  10. subnet {{ dhcp_cidr|ansible.utils.ipaddr('network') }} netmask {{ dhcp_cidr|ansible.utils.ipaddr('netmask') }} {
  11. option routers {{ dhcp_gw_default }};
  12. option domain-name-servers {{ dhcp_gw_default }}, {{ dns_primary }}, {{ dns_secondary }};
  13. option domain-name "{{ dhcp_domain }}";
  14. # Dynamic IPs
  15. range {{ dhcp_range_start }} {{ dhcp_range_end }};
  16. class "secured" {
  17. option routers {{ dhcp_gw_secured }};
  18. match hardware;
  19. }
  20. class "cloudflare" {
  21. option domain-name-servers 1.1.1.3, 1.0.0.3; # cloudflare block malware + porn
  22. match hardware;
  23. }
  24. class "devnull" {
  25. option domain-name-servers 127.0.0.1;
  26. match hardware;
  27. }
  28. # nothing in here (yet)
  29. class "default" {
  30. match hardware;
  31. }
  32. {% for node in reservations %}
  33. subclass "{{ node.type }}" 1:{{ node.mac }}; # {{ node.name }}
  34. {% endfor %}
  35. {% for node in reservations %}
  36. host {{ node.name }}
  37. {
  38. hardware ethernet {{ node.mac }};
  39. fixed-address {{ node.ip }};
  40. }
  41. {% endfor %}
  42. }