# -*- mode: python; encoding: utf-8 -*- info["owner"] = "root" info["group"] = "root" info["perms"] = 0600 comment_start = "#" header("Configuration pour le cluster dhcp pour %s" % admhostname) include("ip") import config if len(config.dhcp_servers) > 2: print "####################################################################" print "## ATTENTION LA CONFIGURATION NE PEUT PAS GÉRER PLUS DE DEUX DHCP ##" print "####################################################################" myip = admip() herip = admipof([name for name in config.dhcp_servers if name != admhostname][0].split('.',1)[0]) print 'failover peer "dhcp-failover" {' if has("dhcp-server-primary"): print """ primary; split 128; mclt 3600;""" elif has("dhcp-server-secondary"): print " secondary;" print """ 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)