Automate the creation of CoreOs and Ubuntu vms on KVM
- ruby
- git
- qemu-img
- virt-install
- virsh
- wget
- bzip2
- dd
- gzip
- perl
- libxml-simple-perl
- libsys-virt-perl
Configure the virtualization host following these steps
Get the latest version
git clone --depth 1 https://github.com/camilin87/kvm-automation.git
cd kvm-automation
git pull --rebase origin master
ruby vm_task.rb CoreOsVmCreationTask \
--path ~/vms/ \
--name vm1 \
--img ~/vm-templates/coreos_production_qemu_image.img \
--key ~/vm-templates/id_rsa.pub
ruby vm_task.rb UbuntuVmCreationTask \
--path ~/vms/ \
--name vm2 \
--os-variant "ubuntu16.04" \
--img ~/vm-templates/ubuntu-16.04.2-server-amd64.iso
# At this point the command will display the vm's mac address and vnc port
# From your host vnc to `vmhost.local:<VNC_PORT>` and finish the installation
ruby vm_task.rb UbuntuVmRestoreTask \
--path ~/vms/ \
--name vm3 \
--os-variant "ubuntu16.04" \
--img ~/vm-backups/vm1/20170701000000/vm1/vm1_vda.img.gz
sudo ruby vm_task.rb HddShrinkTask --path ~/vms/ --name vm3
sudo ruby vm_task.rb VmBackupTask --path ~/vm-backups/ --name vm1
ruby vm_task.rb ReadVmBackupPathTask --path ~/vm-backups/ --name vm1
ruby vm_task.rb VmDeletionTask --path ~/vms/ --name vm1
sudo ruby vm_task.rb DeleteAllVmBackupsTask --path ~/vm-backups/ --name vm1
ruby vm_task.rb ReadVmMacTask --name vm1
ruby vm_task.rb ReadVmVncInfoTask --name vm1