Files
2026-02-21 16:54:18 +01:00

57 lines
2.0 KiB
Django/Jinja

# ISC DHCP Configuration for {{ gateway_config.lab_name }}
# Generated by Ansible
authoritative;
ddns-update-style none;
default-lease-time 43200; # 12 hours
max-lease-time 86400; # 24 hours
# Failover configuration
{% if gateway_config.dhcp_role == 'primary' %}
failover peer "{{ gateway_config.lab_name }}-failover" {
primary;
address {{ gateway_config.wg_ip }};
port 647;
peer address {{ failover_peer_ip }};
peer port 647;
max-response-delay {{ isc_dhcp_failover.max_response_delay }};
max-unacked-updates {{ isc_dhcp_failover.max_unacked_updates }};
mclt {{ isc_dhcp_failover.mclt }};
split {{ isc_dhcp_failover.split }};
load balance max seconds {{ isc_dhcp_failover.load_balance_max_seconds }};
}
{% elif gateway_config.dhcp_role == 'secondary' %}
failover peer "{{ gateway_config.lab_name }}-failover" {
secondary;
address {{ gateway_config.wg_ip }};
port 647;
peer address {{ failover_peer_ip }};
peer port 647;
max-response-delay {{ isc_dhcp_failover.max_response_delay }};
max-unacked-updates {{ isc_dhcp_failover.max_unacked_updates }};
load balance max seconds {{ isc_dhcp_failover.load_balance_max_seconds }};
}
{% endif %}
# Subnet declaration
subnet {{ gateway_config.subnet | ipaddr('network') }} netmask {{ gateway_config.subnet | ipaddr('netmask') }} {
option routers {{ gateway_config.subnet | ipaddr('1') | ipaddr('address') }};
option domain-name-servers {{ gateway_config.subnet | ipaddr('1') | ipaddr('address') }};
option domain-name "{{ gateway_config.lab_name }}.lab";
{% if gateway_config.dhcp_role in ['primary', 'secondary'] %}
pool {
failover peer "{{ gateway_config.lab_name }}-failover";
range {{ gateway_config.subnet | ipaddr('10') | ipaddr('address') }} {{ gateway_config.subnet | ipaddr('245') | ipaddr('address') }};
}
{% else %}
# Backup server - only serves when primary/secondary unavailable
pool {
range {{ gateway_config.subnet | ipaddr('10') | ipaddr('address') }} {{ gateway_config.subnet | ipaddr('245') | ipaddr('address') }};
}
{% endif %}
}
# Logging
log-facility local7;