I find that I’m often repeating myself and wasting time creating the same virtual machines over and over again, and would like to know if there’s a faster way to deploy vm’s?
I would like to be able to run a single command to provision a machine automatically as follows:
Pick an OS (Debian 10.5)
Attach network bridge br0, with a randomly generated MAC
Assign a static IP address to the interface, provided in the provision command.
Drop a custom bashrc in root and in username’s home.
Add username, install sudo package, and username to sudo group
set root and username password.
Drop authorized_keys into the root/username .ssh folders
Install any packages specified in a package list.
Run updates.
Set hostname, nameservers, etc, customize resolv.conf
I’ve tried creating a base install by hand and copying, the image, but there’s always problems. Lately, with the UEFI VM firmware, dding images seems to break them. Besides, it’s always annoying when you need to modify your base image, and it’s not really setup as a vm, etc. (what do you mean rsync isn’t installed by default!?)
So I know that Debian has automated install scripts, but I’m not sure how great that works (some sites say it doesn’t work well).
I’m sure you can create customized images for both of them, and lxd supports something called profiles, I’m not sure if multipass has this feature.
Yes, I know lxd is for managing containers (a wrapper around lxc) BUT for some reason canonical made lxd capable of manging KVM virtual machines… I don’t know why this feature is in lxd
Also I think I’ve never got networking for VMs created using lxd working on my archlinux installation… if anyone is willing to test it on their system, please let me know if it works for you.
Need to investigate more. Thanks for suggestions, I had a motherboard failure on the desktop and RAID issues on the NFS server consume the week.
There’s also an option for making custom images with preseed, but not sure how well it works. And it wouldn’t add all the stuff I do after the install.
I have only a little experience with Ansible. I though it is only useable from the point where I have SSH access to the machine. Are you sure you can provision a virtual machine from the host and set it up or how would the process look like in that case?