You may need to hit "enter" for the login prompt to show up. Log in as root and run "dhclient eth0" then "ip address" and find the IP address of the new machine. The IP address can also be changed with the following (XXX are the normal IP inputs for the lab and YYY is the new IP ending):

And you're good to go! Make sure to remove the temporary entry from the inventory and add the new static IP, and commit/push the change. You may also want to Create a DNS Entry for the new VM and allow access to it through the Firewall.

Creating a new base image

To the largest extent possible, we use ansible to manage service configuration and machine bringup. Because ansible does all of the necessary configuration, the base images should be as stock as possible.

Creating a VM Environment

The easiest way to use virtualization on Linux is with virt-manager. On Ubuntu, follow [1]. It is packaged on most distros. Make sure to check your distro's documentation, as you likely need to add yourself to a certain group to get permissions to manage virtual machines. Download a setup ISO for the distro you are creating a base image for. Here's some screenshots of the steps to follow.

Select "browse local" and find the ISO you're using.

The settings you use here don't particularly matter, since only the resulting disk image will be used.

Select 16GiB, which is our default base disk size.

Click "finish"

Installing and Configuring Debian

Boot the new VM, and select "install".

Select the locale.

Wait...

The default hostname is fine, Ansible will change it when necessary.

Leave this empty.

Enter the COSI Default Root Password.

Create the ansible user.

Use cspassword.

The defaults here are fine.

Finish partitioning.

Write changes.

Wait...

Chose US.

Chose the default.

No proxy.

Don't participte in the popularity contest.

Use the arrow keys and spacebar to deselect everything and select SSH server, then continue.

Use the defaults for GRUB.

Wait...

Installation complete!

Now that installation is complete, some additional setup is needed. Log in as root.

The first command installs TLS certificates (needed for the later wget), sudo (so the ansible user can elevate permissions), and Python (needed for ansible). The third command enables a login console on the ttyS0 device, which will be used for 'virsh console' later. The rest is setting up ansible's public key for configuration when a new VM is spinned up from this image.

Finding the finished disk image

It will probably be in /var/lib/libvirt/images/name.qcow2. If not, open the VM in virt-manager and go to the information pane, and select VirtIO Disk 1 and look at the source path.

Deleting a VM

First, triple-check with the maintainer that they want their VM deleted. Then, in a virsh console with suitable privileges, run shutdown vmname. Wait at least a minute for the VM to shutdown (which you can observe with list). If the machine doesn't shutdown quickly, use console or talk to the maintainer to figure out what is wrong. If the maintainer doesn't care about an unclean shutdown, do destroy vmname. Once the VM is off, you can use undefine vmname to remove the VM's definition from libvirtd. Exit the virsh console, and move the VM files /var/lib/libvirt/images/vmname.qcow2 and /var/lib/libvirt/xml/vmname.xml to /var/lib/libvirt/trash and modify the README there to have the date and the VM name. Remember to go through and actually delete these files after at least a week as passed -- if we aren't pressed for disk space, the trash never needs to be emptied, which gives a better experience for maintainers who accidentally forget important data.