Autogénération de /etc/network/interfaces.local
darcs-hash:20080210155051-41f88-47060e3196b5245eadaa494503c47a45d48e47d5.gz
This commit is contained in:
parent
264fedda39
commit
2c871ebe22
4 changed files with 61 additions and 0 deletions
|
@ -17,10 +17,16 @@
|
||||||
<ConfigFile name="/etc/crans/secrets/secrets.py"/>
|
<ConfigFile name="/etc/crans/secrets/secrets.py"/>
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
|
|
||||||
|
<Package name="resolvconf"/>
|
||||||
</Group>
|
</Group>
|
||||||
|
|
||||||
<Group name="fstab.local">
|
<Group name="fstab.local">
|
||||||
<!-- Autogénération du fstab -->
|
<!-- Autogénération du fstab -->
|
||||||
<ConfigFile name="/etc/fstab"/>
|
<ConfigFile name="/etc/fstab"/>
|
||||||
</Group>
|
</Group>
|
||||||
|
|
||||||
|
<Group name="interfaces.local">
|
||||||
|
<ConfigFile name="/etc/network/interfaces"/>
|
||||||
|
</Group>
|
||||||
</Base>
|
</Base>
|
||||||
|
|
|
@ -428,4 +428,7 @@
|
||||||
<Group name="fstab.local"
|
<Group name="fstab.local"
|
||||||
comment="indique l'exsitence de /etc/fstab.local"/>
|
comment="indique l'exsitence de /etc/fstab.local"/>
|
||||||
|
|
||||||
|
<Group name="interfaces.local"
|
||||||
|
comment="indique l'exsitence de /etc/network/interfaces.local"/>
|
||||||
|
|
||||||
</Groups>
|
</Groups>
|
||||||
|
|
10
Probes/interfaces.local
Executable file
10
Probes/interfaces.local
Executable file
|
@ -0,0 +1,10 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ ! -f /etc/network/interfaces.local ]; then
|
||||||
|
echo "none"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "group:interfaces.local"
|
||||||
|
|
||||||
|
exec cat /etc/network/interfaces.local
|
42
Python/etc/network/interfaces
Normal file
42
Python/etc/network/interfaces
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
# -*- coding: utf-8; mode: python -*-
|
||||||
|
|
||||||
|
include("ip")
|
||||||
|
|
||||||
|
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:
|
||||||
|
|
||||||
|
- mode est soit pub soit adm
|
||||||
|
- 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.3
|
||||||
|
dns-search crans.org""" % { 'interface': interface, 'ip': pubip() }
|
||||||
|
else:
|
||||||
|
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
|
||||||
|
dns-search adm.crans.org""" % { 'interface': interface, 'ip': admip() }
|
||||||
|
|
||||||
|
for line in additionnals:
|
||||||
|
print " ", line
|
||||||
|
print
|
||||||
|
|
||||||
|
exec metadata.probes["interfaces.local"]
|
Loading…
Add table
Add a link
Reference in a new issue