dhcpd: add support for failover

pull/94/head
jeltz 2 years ago
parent 6bb2bbb54f
commit 69c3949ef8
Signed by: jeltz
GPG Key ID: 800882B66C0C3326

@ -5,4 +5,11 @@ dhcpd__max_lease_time: 7200
dhcpd__dns_servers: []
dhcpd__domain_search: []
dhcpd__subnets: []
dhcpd__failover_port: 519
dhcpd__failover_mclt: 3600
dhcpd__failover_split: 128
dhcpd__failover_max_response_delay: 60
dhcpd__failover_max_unacked_updates: 10
dhcpd__failover_lb_max_seconds: 3
dhcpd__omapi_port: 7911
...

@ -7,12 +7,43 @@ ddns-update-style none;
authoritative;
{% if dhcpd__omapi_key | default({}) %}
omapi-port {{ dhcpd__omapi_port }};
omapi-key omapi_key;
key omapi_key {
algorithm {{ dhcpd__omapi_key.algorithm }};
secret {{ dhcpd__omapi_key.secret }};
}
{% endif %}
{% if dhcpd__subnets | selectattr("failover", "true") | list %}
failover peer "peer" {
{% if dhcpd__failover_primary | default(false) %}
primary;
mclt {{ dhcpd__failover_mclt }};
split {{ dhcpd__failover_split }};
{% else %}
secondary;
{% endif %}
address {{ dhcpd__failover_address }};
port {{ dhcpd__failover_port }};
peer address {{ dhcpd__failover_peer_address }};
peer port {{ dhcpd__failover_peer_port
| default(dhcpd__failover_port) }};
max-response-delay {{ dhcpd__failover_max_response_delay }};
max-unacked-updates {{ dhcpd__failover_max_unacked_updates }};
load balance max seconds {{ dhcpd__failover_lb_max_seconds }};
}
{% endif %}
{% if dhcpd__dns_servers | default([]) %}
option domain-name-servers {{ dhcpd__dns_servers | join(", ") }};
{% endif %}
{% if dhcpd__domain_search | default([]) %}
option domain-search {{ dhcpd__domain_search | map("enquote") | join(", ") }};
option domain-search {{ dhcpd__domain_search
| map("enquote") | join(", ") }};
{% endif %}
{% for subnet in dhcpd__subnets %}
@ -20,7 +51,12 @@ subnet {{ subnet.network
| ansible.utils.ipaddr("network") }}
netmask {{ subnet.network
| ansible.utils.ipaddr("netmask") }} {
range {{ subnet.start }} {{ subnet.end }};
pool {
range {{ subnet.start }} {{ subnet.end }};
{% if subnet.failover | default(false) %}
failover peer "peer";
{% endif %}
}
{% if subnet.routers | default([]) %}
option routers {{ subnet.routers | join(", ") }};
{% endif %}

Loading…
Cancel
Save