From 4236493912f5bd839fb3c094057e8e4f334e99ff Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Tue, 10 Dec 2019 23:22:12 -0500 Subject: [PATCH] Add DHCP in example debootstrap script --- client-provisioner/examples/debootstrap_script.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/client-provisioner/examples/debootstrap_script.py b/client-provisioner/examples/debootstrap_script.py index 38dce8f6..0e0d2b9a 100644 --- a/client-provisioner/examples/debootstrap_script.py +++ b/client-provisioner/examples/debootstrap_script.py @@ -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: