@EddieJennings said in Script for Creating VMs from Template VM in KVM:
@travisdh1 said in Script for Creating VMs from Template VM in KVM:
@EddieJennings said in Script for Creating VMs from Template VM in KVM:
@Pete-S said in Script for Creating VMs from Template VM in KVM:
Not the exactly the same thing but you might want to look into how to create a VM from scratch.
Meaning a script that will set up a VM with vCPU, memory, storage, network etc and then boot it from iso and have it do an unattended install, create what users you want and install the packages you need.That's one of the next things I'm looking into.
@EddieJennings Also remember about things like kickstart in RedHat based operating systems. In Fedora/CentOS/RHOS you can use a kickstart file to automatically select all the install time options for the OS. A short time later you've got a fresh server and all the time it took you to setup was running the creation script on your hypervisor.
One of the things I'll need to figure out going the Kickstart route is setting the hostname what I want it to be at the time of installation. Likely not difficult to do, I just have to figure it out. Or perhaps, I can just truly take the approach of just making a clean minimal install, and then later configure to whatever specific thing I'm wanting the VM to do for my lab / testing.
Inside the kickstart file you'll find something like this:
network --hostname=centos8-4.example.comWe use debian as our goto and then it's called a preseed file. The only real thing that can be tricky is to tell the installation what kickstart/preseed file you want to use. You can do it in different ways. If you don't want to rely on dhcp/tftp/pxe etc you can roll your own iso file. I think the kickstart file can also be mounted as a drive that the installation will detect when it starts.
I think the best approach is to make an automated installation with same basic settings and some of those will get changed later in the installation. For example you can use a fixed hostname that is later changed from ansible.