Skip to main content

Posts

Showing posts from June, 2022

Create VMs with Ansible and KVM on multiple Linux hosts

This is a quick presentation of a simple way to automate creation of VMs on multiple Linux hosts. At the end of this article there is a link to GitHub containing this Ansible project. Prerequisites - few host machines running Linux.  - KVM installed on each host. - an SSH key provisioned on each host. - Ansible installed on the machine that performs the installation, which can be one of the hosts. - The Ansible inventory file containing the hosts to be used in installation. Currently all the hosts under vmhosts will be used. How to create a VM with KVM Creating a VM with KVM is done using a cloud image because it is relatively easy to configure it. At the very minimum, we need to be able to set the VM name, specify some default packages to install, then configure at least one user so we can ssh into that VM. Many distros provide cloud images. Here are some: - Ubuntu - Debian - Fedora The above sites host images for multiple cloud providers and in various d...