Skip to content

Build a home lab by using Terraform's dmacvicar/libvirt provider to create multiple VMs of a chosen Linux OS all at once.

Notifications You must be signed in to change notification settings

rossijonas/virt-lab-creator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

virt-lab-creator

Build a home lab by using Terraform's dmacvicar/libvirt provider to create multiple VMs of a chosen Linux OS all at once.

About

This repository helps to quickly create and destroy a home lab of virtual machines that may be used to study, play, and testing purposes.

Let's say you need to create 4 RHEL VMs to practice for the RHCSA exam, or you need to create 3 Rocky Linux VMs to learn Ansible and test playbooks, create it with terraform apply and quickly destroy all resources when finished terraform destroy.

For each home lab created:

  • A default network interface is created and started in each VM.

  • A default admin user with sudo privileges is created in each VM.

  • The Pool, Volumes, and cloud-init disks created will be stored in the /home/<user>/libvirt_storage/ directory.

Requirements

How To Use

  1. Clone or download this repository.

  2. Create a directory named images/ inside the repository directory, download the chosen Linux OS image, and save it inside the images/ directory.

  3. Edit the variables.tf file providing the specifications desired for your home lab.

  4. Set up the home lab as you wish. Inside the repository directory, run:

    • terraform init - to initiate and download required providers.

    • terraform validate - to double check for any unintentional edit.

    • terraform plan - to inspect what will be created.

  5. Run terraform apply -auto-approve to create the home lab.

  6. Open Virtual Machine Manager, manually start any newly created VM, and log in with the default credentials:

    user: admin / password: adminpwd

  7. Destroy the lab with: terraform destroy -auto-approve

To create a second home lab just download or clone the repository again into another directory, and repeat the steps above.

About

Build a home lab by using Terraform's dmacvicar/libvirt provider to create multiple VMs of a chosen Linux OS all at once.

Topics

Resources

Stars

Watchers

Forks

Languages