mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-24 07:26:29 +00:00
Updates to networking in vbox
This commit is contained in:
parent
5dcec10d65
commit
885ace7b48
4 changed files with 30 additions and 18 deletions
|
@ -12,6 +12,15 @@ class RemoveDNSInfo(Task):
|
||||||
remove(os.path.join(info.root, 'etc/resolv.conf'))
|
remove(os.path.join(info.root, 'etc/resolv.conf'))
|
||||||
|
|
||||||
|
|
||||||
|
class RemoveHostname(Task):
|
||||||
|
description = 'Removing the hostname file'
|
||||||
|
phase = phases.system_modification
|
||||||
|
|
||||||
|
def run(self, info):
|
||||||
|
from os import remove
|
||||||
|
remove(os.path.join(info.root, 'etc/hostname'))
|
||||||
|
|
||||||
|
|
||||||
class ConfigureNetworkIF(Task):
|
class ConfigureNetworkIF(Task):
|
||||||
description = 'Configuring network interfaces'
|
description = 'Configuring network interfaces'
|
||||||
phase = phases.system_modification
|
phase = phases.system_modification
|
||||||
|
@ -26,13 +35,3 @@ class ConfigureNetworkIF(Task):
|
||||||
'iface eth0 inet dhcp\n'}
|
'iface eth0 inet dhcp\n'}
|
||||||
with open(interfaces_path, 'a') as interfaces:
|
with open(interfaces_path, 'a') as interfaces:
|
||||||
interfaces.write(if_config.get(info.manifest.system['release']))
|
interfaces.write(if_config.get(info.manifest.system['release']))
|
||||||
|
|
||||||
|
|
||||||
class ConfigureDHCP(Task):
|
|
||||||
description = 'Configuring the DHCP client'
|
|
||||||
phase = phases.system_modification
|
|
||||||
|
|
||||||
def run(self, info):
|
|
||||||
from common.tools import sed_i
|
|
||||||
dhcpcd = os.path.join(info.root, 'etc/default/dhcpcd')
|
|
||||||
sed_i(dhcpcd, '^#*SET_DNS=.*', 'SET_DNS=\'yes\'')
|
|
||||||
|
|
|
@ -16,7 +16,8 @@ from common.tasks import apt
|
||||||
from tasks import boot
|
from tasks import boot
|
||||||
from common.tasks import boot as common_boot
|
from common.tasks import boot as common_boot
|
||||||
from common.tasks import security
|
from common.tasks import security
|
||||||
from common.tasks import network
|
from tasks import network
|
||||||
|
from common.tasks import network as common_network
|
||||||
from tasks import initd
|
from tasks import initd
|
||||||
from common.tasks import initd as common_initd
|
from common.tasks import initd as common_initd
|
||||||
from common.tasks import cleanup
|
from common.tasks import cleanup
|
||||||
|
@ -56,9 +57,9 @@ def tasks(tasklist, manifest):
|
||||||
security.EnableShadowConfig(),
|
security.EnableShadowConfig(),
|
||||||
security.DisableSSHPasswordAuthentication(),
|
security.DisableSSHPasswordAuthentication(),
|
||||||
security.DisableSSHDNSLookup(),
|
security.DisableSSHDNSLookup(),
|
||||||
network.RemoveDNSInfo(),
|
common_network.RemoveDNSInfo(),
|
||||||
network.ConfigureNetworkIF(),
|
common_network.ConfigureNetworkIF(),
|
||||||
network.ConfigureDHCP(),
|
network.EnableDHCPCDDNS(),
|
||||||
common_initd.ResolveInitScripts(),
|
common_initd.ResolveInitScripts(),
|
||||||
initd.AddEC2InitScripts(),
|
initd.AddEC2InitScripts(),
|
||||||
common_initd.InstallInitScripts(),
|
common_initd.InstallInitScripts(),
|
||||||
|
|
15
providers/ec2/tasks/network.py
Normal file
15
providers/ec2/tasks/network.py
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
from base import Task
|
||||||
|
from common import phases
|
||||||
|
import os.path
|
||||||
|
|
||||||
|
|
||||||
|
class EnableDHCPCDDNS(Task):
|
||||||
|
description = 'Configuring the DHCP client to set the nameservers'
|
||||||
|
phase = phases.system_modification
|
||||||
|
|
||||||
|
def run(self, info):
|
||||||
|
# The dhcp client that ships with debian sets the DNS servers per default.
|
||||||
|
# For dhcpcd we need to configure it to do that.
|
||||||
|
from common.tools import sed_i
|
||||||
|
dhcpcd = os.path.join(info.root, 'etc/default/dhcpcd')
|
||||||
|
sed_i(dhcpcd, '^#*SET_DNS=.*', 'SET_DNS=\'yes\'')
|
|
@ -50,15 +50,12 @@ def tasks(tasklist, manifest):
|
||||||
common_boot.BlackListModules(),
|
common_boot.BlackListModules(),
|
||||||
common_boot.DisableGetTTYs(),
|
common_boot.DisableGetTTYs(),
|
||||||
security.EnableShadowConfig(),
|
security.EnableShadowConfig(),
|
||||||
security.DisableSSHPasswordAuthentication(),
|
|
||||||
security.DisableSSHDNSLookup(),
|
|
||||||
network.RemoveDNSInfo(),
|
network.RemoveDNSInfo(),
|
||||||
network.ConfigureNetworkIF(),
|
network.ConfigureNetworkIF(),
|
||||||
network.ConfigureDHCP(),
|
network.RemoveHostname(),
|
||||||
initd.ResolveInitScripts(),
|
initd.ResolveInitScripts(),
|
||||||
initd.InstallInitScripts(),
|
initd.InstallInitScripts(),
|
||||||
cleanup.ClearMOTD(),
|
cleanup.ClearMOTD(),
|
||||||
cleanup.ShredHostkeys(),
|
|
||||||
cleanup.CleanTMP(),
|
cleanup.CleanTMP(),
|
||||||
apt.PurgeUnusedPackages(),
|
apt.PurgeUnusedPackages(),
|
||||||
apt.AptClean(),
|
apt.AptClean(),
|
||||||
|
|
Loading…
Add table
Reference in a new issue