on ajoute les machines qui auront un autre template pour le dhcp
faudra ajouter les autres machines en dur ici darcs-hash:20060609211036-4ec08-34196af6d79cee5e20ec4c2cf87a2161cb217215.gz
This commit is contained in:
parent
b03c53eeae
commit
d3da8dc087
1 changed files with 32 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue