#!/bin/sh
# Script to build a new VM based on a kickstart.cfg file template
# with virt-install
# Author Georgi Georgiev hip0
# hipo@Pc-freak.net

KS_FILE='kickstart.cfg';
VM_NAME='RHEL8_3-VirtualMachine';
VM_DESCR='CentOS 8.3 Virtual Machine';
RAM='8192';
CPUS='8';
# size is in Gigabytes
VM_IMG_SIZE='70';
ISO_LOCATION='/vmprivate/rhel-server-8.3-x86_64-dvd.iso';
VM_IMG_FILE_LOC='/vmprivate/RHEL8_3-VirtualMachine.img';

virt-install -n "$VMNAME" --description "$VM_DESCR" --os-type=Linux --os-variant=rhel8.3 --ram=8192 --vcpus=8 --location="$ISO_LOCATION" --disk path=$VM_IMG_FILE,bus=virtio,size=$IMG_VM_SIZE --graphics none --initrd-inject=/root/$KS_FILE --extra-args "console=ttyS0 ks=file:/$KS_FILE"
