work-vm/README.md

4 KiB

My generic work VM

This repo contains a Vagrant configuration along with provisioning scripts which can generate a blank, "work" VM. This VM must be installed on libvirt as recent versions of Virtual Box don't really work for nested virtualization.

Features

This VM includes the following features:

  • a pair of networks which can be used to host virtual machines,
  • a Bind DNS server that can serve a local zone as well as reverse zones for both networks, with a key that can be used to update the zones using Terraform,
  • a local resolver configuration that will forward to either the local Bind server (for queries on the local zones) or to the host (for other queries),
  • Docker and libvirt,
  • a full XFCE environment with Firefox, Remmina, KeepassXC and LibreOffice installed,
  • various IaC tools: Terraform, Terragrunt and Ansible,
  • various programming languages: Rust, Golang, Node and Java,
  • the ability to use Chezmoi to import various dot files at provisioning time,
  • a semi-decent ZSH configuration as well as my Vim configuration.

Installation

Clone the repository:

git clone https://git.nocternity.net/tseeker-pub/work-vm my-local-name

If necessary, export some the following environment variables:

Variable Default Description
VM_CPU 4 The amount of CPUs to allocate to the VM.
VM_MEMORY 16384 The amount of memory to allocate (megabytes).
APT_PROXY empty APT proxy URL, if one is to be used.
VM_LOCALE en_GB.UTF-8 Locale to configure on the VM.
CHEZMOI_SOURCE empty Git URL to initialize Chezmoi from.
VMNET_BACK_ADDR 10.0.0.0 Address of the main "backend" network to be used for VMs inside the work VM. It will be interpreted as a /24 network.
VMNET_FRONT_ADDR 10.0.1.0 Address of the secondary, "service" network to be used for VMs. It will be interpreted as a /24.
VMNET_DOMAIN envdev.test Local domain name.
VMNET_BIND_KEY_ID terraform.${VMNET_DOMAIN} Bind key identifier.
VMNET_BIND_KEY empty HMAC-SHA512 Bind key to import. A key will be generated automatically if this variable is empty.

Then run Vagrant to provision the VM.

vagrant up

Known issues

  • The keyboard is configured to a French layout and there's no way to override it.
  • The Chezmoi Git repo must be given using the full ssh://git@... URL if SSH is in use, otherwise initialization will fail (the script relies on the full URL syntax to extract the host name and fetch the host's key)
  • The VM's Spice display is not configured properly due to a limitation of the libvirt plugin. It is necessary to configure it to listen locally if the builtin desktop needs to be used.