
Ignore-this: 11a2a219c279dae2146ed2890a595dd0 darcs-hash:20090421164610-ffbb2-26922ac05108a20b43f8084c9bf73af9175d2aeb.gz
95 lines
2.5 KiB
Python
95 lines
2.5 KiB
Python
# -*- coding: utf-8; mode: python -*-
|
|
|
|
include("ip")
|
|
|
|
info["owner"] = "root"
|
|
info["group"] = "root"
|
|
info["perms"] = 0644
|
|
|
|
header("""
|
|
Les modifications locales sont à mettre dans le fichier /etc/network/interfaces.local
|
|
|
|
Voir http://wiki.crans.org/CransTechnique/Bcfg2/... pour plus d'explications.
|
|
""")
|
|
|
|
def dev(interface, mode, additionnals=[]):
|
|
"""Génération de la conf d'une interface:
|
|
|
|
- additionnals contient des lignes à mettre en plus à la définition"""
|
|
|
|
if mode == "pub":
|
|
print """auto %(interface)s
|
|
iface %(interface)s inet static
|
|
address %(ip)s
|
|
network 138.231.136.0
|
|
netmask 255.255.248.0
|
|
broadcast 138.231.143.255
|
|
gateway 138.231.136.4
|
|
dns-nameservers 138.231.136.10 138.231.136.9 138.231.136.3
|
|
dns-search crans.org""" % { 'interface': interface, 'ip': pubip() }
|
|
|
|
elif mode == "adm":
|
|
print """auto %(interface)s
|
|
iface %(interface)s inet static
|
|
address %(ip)s
|
|
network 10.231.136.0
|
|
netmask 255.255.255.0
|
|
broadcast 10.231.136.255
|
|
mtu 1496
|
|
dns-nameservers 10.231.136.10 138.231.136.9 10.231.136.3
|
|
dns-search adm.crans.org""" % { 'interface': interface, 'ip': admip() }
|
|
|
|
elif mode == "radin":
|
|
print """auto %(interface)s
|
|
iface %(interface)s inet static
|
|
address %(ip)s
|
|
network 10.42.0.0
|
|
netmask 255.255.0.0
|
|
broadcast 10.42.255.255
|
|
mtu 1496""" % { 'interface': interface, 'ip': radinip() }
|
|
|
|
elif mode == "accueil":
|
|
print """auto %(interface)s
|
|
iface %(interface)s inet static
|
|
address %(ip)s
|
|
network 10.51.0.0
|
|
netmask 255.255.0.0
|
|
broadcast 10.51.255.255
|
|
mtu 1496""" % { 'interface': interface, 'ip': accueilip() }
|
|
|
|
elif mode == "ens":
|
|
print """auto %(interface)s
|
|
iface %(interface)s inet static
|
|
address %(ip)s
|
|
network 10.2.9.0
|
|
netmask 255.255.255.0
|
|
broadcast 10.2.9.255
|
|
mtu 1496""" % { 'interface': interface, 'ip': appt_ens_ip() }
|
|
|
|
elif mode == "isolement":
|
|
print """auto %(interface)s
|
|
iface %(interface)s inet static
|
|
address %(ip)s
|
|
network 10.52.0.0
|
|
netmask 255.255.0.0
|
|
broadcast 10.52.255.255
|
|
mtu 1496""" % { 'interface': interface, 'ip': isolementip() }
|
|
|
|
elif mode == "manuel":
|
|
print """auto %(interface)
|
|
iface %(interface)s inet static""" % { 'interface': interface }
|
|
|
|
else:
|
|
raise NotImplementedError, "Mode de réseau inconnu : %s" % mode
|
|
|
|
for line in additionnals:
|
|
print " ", line
|
|
print
|
|
|
|
# Définitions communes
|
|
print """auto lo
|
|
iface lo inet loopback
|
|
"""
|
|
|
|
|
|
exec metadata.probes["interfaces_local"]
|