Skip to main content
  1. n3tuk Documentation/

Virtual Machine Server Configuration

··3 mins·
This document is currently just a placeholder; it has yet to be written.
Please wait for it to be updated.

Sub-Documents #

DocumentDescription
PartitionsA breakdown of the partitions layout for all the virtual machines.
Arch Linu InstallationA step-by-step guide for the initial configuration of Arch Linux on virtual machines using commands in the live-boot environment, and Ansible

Initial Configuration #

All virtual machines in the Lab environment are managed through Ansible, which will configure the QEMU instance through libvirtd and boot it using the Arch Linux installation image, ready for bootstrapping.

Ansible #

There are two components to the creation of a Virtual Machine:

  1. The configuration of the virtual machine itself on the node that will host it; and
  2. The configuration of the basic configuration of that host within Ansible itself so that it can be bootstrapped, baselined, and the relevant services deployed.

Create the Virtual Machine #

Each virtual machine is allocated to a specific host as this Lab environment does not support pools, but this is intentional as so to be able to treat nodes as availability zones and network segments, providing a pseudo CSP environment for testing.

Under the plays/host_vars directory of the ansible repository are multiple files related to each of the virtual machine hosts (called node-xx.y.z.kub3.uk.yaml, where xx is the number of the node, y is the initial of the environment, and x is the location). Within this file is a list called machines_list, to which a virtual machine configuration can be appended:

# Create a virtual machine called name-01 in the development environment of
# cym-south-1. Each of these help define the hostname and.
- name: name-01
  environment: development
  location: cym-south-1
  # Optionally, add the purpose of the node which will be added to the node
  # title in libvirtd for quick reference.
  purpose: boundary-node
  # Define the number of vCPUs and the amount of memory required. The current
  # argument defines how much it will run with, and if it should be allowed to
  # increase, max: can be set to the maximum amount it can grow to.
  vcpu: 1
  memory:
    current: 1
    # Allow the memory to be shared across nodes through overcommitting
    shared: true
  # Define the volumes which should be attached to the virtual machine, their
  # name, and their size.
  volumes:
    - dev: vda
      size: 32G
  # Which VLAN should be used for the ethernet device on this virtual host,
  # effectively defining which bridge it should be attached to.
  vlan: 50

This can be deployed using the libvirtd task:

$ task libvirtd limit={node-hostname}

Configure Ansible #

Once the virtual machine is ready to be bootstrapped, one file needs to be updated (the inventory.yaml file) and two need to be added: (one under plays/host_vars, and optionally one under plays/group_vars, depending on the inventory configuration).

First, inside the inventory.yaml file, add an entry under one of the hosts: maps, or create a {name}.hosts key under all.children where {name} is the name of a new group. Also add it to one of services.hosts, production.hosts, or development.hosts depending on the environment it belongs to.

Next, create a file called plays/host_vars/{hostname}.yaml which contains, at a minimum, the IPv4 and IPv6 addresses of the host being configured:

---
systemd_networkd_ipv4_address: {ip-address}/{prefix}
systemd_networkd_ipv4_gateway: {ip-address}
systemd_networkd_ipv6_address: {ip-address}/{prefix}

If an additional group configuration is required, create that too. Once done, the virtual machine can be bootstrapped.

Bootstrapping #

To bootstrap the new virtual machine, follow through the steps in the Arch Linux Installation guide.