From 3530b825e2d48c28703bb04920e4ec24a0e5565c Mon Sep 17 00:00:00 2001 From: Kishi85 Date: Mon, 13 May 2024 18:06:35 +0200 Subject: [PATCH] kea: add DHCP4 HA config (hot-standby) --- roles/kea/templates/kea/kea-dhcp4.conf.j2 | 33 +++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/roles/kea/templates/kea/kea-dhcp4.conf.j2 b/roles/kea/templates/kea/kea-dhcp4.conf.j2 index 982f313..8678a59 100644 --- a/roles/kea/templates/kea/kea-dhcp4.conf.j2 +++ b/roles/kea/templates/kea/kea-dhcp4.conf.j2 @@ -10,6 +10,39 @@ "socket-name": "/run/kea/kea4-ctrl-socket" }, + "hooks-libraries": [ + { + "library": "/usr/lib/x86_64-linux-gnu/kea/hooks/libdhcp_lease_cmds.so" + }, + + { + "library": "/usr/lib/x86_64-linux-gnu/kea/hooks/libdhcp_ha.so", + "parameters": { + "high-availability": [ { + "this-server-name": "{{ inventory_hostname.split('.')[0] }}", + "mode": "hot-standby", + "heartbeat-delay": 10000, + "max-response-delay": 60000, + "max-ack-delay": 5000, + "max-unacked-clients": 5, + "sync-timeout": 60000, + "peers": [ + { + "name": "{{ lookup('dig', dhcpd_primary+'/PTR').split('.')[0] }}", + "url": "http://{{ dhcpd_primary }}:8000/", + "role": "primary" + }, + { + "name": "{{ lookup('dig', dhcpd_secondary+'/PTR').split('.')[0] }}", + "url": "http://{{ dhcpd_secondary }}:8000/", + "role": "standby" + } + ] + } ] + } + } + ], + "lease-database": { "type": "memfile", "lfc-interval": 3600