diff --git a/gestion/gen_confs/dhcpd.py b/gestion/gen_confs/dhcpd.py index 30227afd..54138403 100755 --- a/gestion/gen_confs/dhcpd.py +++ b/gestion/gen_confs/dhcpd.py @@ -101,6 +101,28 @@ subnet %(network)s netmask %(netmask)s { option host-name "%(nom)s"; } """ + + host_template_ltsp_i386=""" + host %(nom)s { + hardware ethernet %(mac)s; + fixed-address %(ip)s; + option host-name "%(nom)s"; + next-server 138.231.136.19; + filename "/ltsp/pxelinux.0"; + option root-path "/opt/ltsp/i386"; +} +""" + + host_template_ltsp_powerpc=""" + host %(nom)s { + hardware ethernet %(mac)s; + fixed-address %(ip)s; + option host-name "%(nom)s"; + next-server 138.231.136.19; + filename "yaboot"; + option root-path "/opt/ltsp/powerpc"; + } +""" ### Verbosité # Si =1 ralera (chaine warnings) si machines hors zone trouvée @@ -133,9 +155,17 @@ subnet %(network)s netmask %(netmask)s { t = 0 for net in self.reseaux.keys() : if AddrInNet(machine.ip(),net) : + # choix du template en fonction de la machine + if machine.nom() in ['momo.crans.org']: + host_template = self.host_template_ltsp_i386 + elif machine.nom() in ['bulle12.crans.org']: + host_template = self.host_template_ltsp_powerpc + else: + host_template = self.host_template + # variable pour remplir le template d = { 'nom' : machine.nom().split('.')[0] , 'mac' : machine.mac() , 'ip' : machine.ip() } - try : hosts[net] += self.host_template % d - except : hosts[net] = self.host_template % d + try : hosts[net] += host_template % d + except : hosts[net] = host_template % d t = 1 ### Ecriture du fichier