38 lines
1,012 B
Python
38 lines
1,012 B
Python
# -*- mode: python; encoding: utf-8 -*-
|
|
|
|
info["owner"] = "root"
|
|
info["group"] = "root"
|
|
info["mode"] = 0600
|
|
|
|
comment_start = "#"
|
|
|
|
header("Configuration pour le cluster dhcp pour %s" % admhostname)
|
|
|
|
include("ip")
|
|
import config
|
|
|
|
if len(config.dhcp_servers) > 2:
|
|
@"####################################################################"
|
|
@"## ATTENTION LA CONFIGURATION NE PEUT PAS GÉRER PLUS DE DEUX DHCP ##"
|
|
@"####################################################################"
|
|
|
|
myip = admip()
|
|
herip = admipof([name for name in config.dhcp_servers if name != admhostname][0].split('.',1)[0])
|
|
|
|
@failover peer "dhcp-failover" {
|
|
if has("dhcp-server-primary"):
|
|
@ primary;
|
|
@ split 128;
|
|
@ mclt 3600;
|
|
elif has("dhcp-server-secondary"):
|
|
@ secondary;
|
|
|
|
out(""" address %s;
|
|
port 647;
|
|
peer address %s;
|
|
peer port 647;
|
|
max-response-delay 30;
|
|
max-unacked-updates 10;
|
|
load balance max seconds 3;
|
|
}
|
|
""" % (myip, herip))
|