Add DHCP in example debootstrap script

This commit is contained in:
Joshua Boniface 2019-12-10 23:22:12 -05:00
parent 911965c1f3
commit 4236493912
1 changed files with 7 additions and 0 deletions

View File

@ -127,6 +127,13 @@ def install(**kwargs):
with open(hostname_file, 'w') as fh:
fh.write("{}".format(vm_name))
# Write a DHCP stanza for ens2
# NOTE: Due to device ordering within the Libvirt XML configuration, the first Ethernet interface
# will always be on PCI bus ID 2, hence the name "ens2".
ens2_network_file = "{}/etc/network/interfaces.d/ens2".format(temporary_directory)
with open(ens2_network_file, 'w') as fh:
fh.write("auto ens2\niface ens2 inet dhcp\n")
# Write the GRUB configuration
grubcfg_file = "{}/etc/default/grub".format(temporary_directory)
with open(grubcfg_file, 'w') as fh: