Skip to content

Ansible role to provision a Linux virtual machine on a KVM host

License

Notifications You must be signed in to change notification settings

HosniNabil/kvmLinuxVM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kvmLinuxVM

Ansible role to provision a Linux virtual machine on a KVM host

Requirements

This role requires:

  • a functional KVM host with configured network and storage
  • a prior download of RHEL cloud images in order to provision RHEL virtual machines
  • Terraform and terraform libvirt provider setup Role Variables

  • vm_hostname: virtual machine template name
  • vm_cpu: number of CPU of the virtual machine
  • vm_memory: memory in MB of the virtual machine
  • vm_network: KVM network to chose
  • vm_ip: VM IP address
  • vm_prefix: VM IP prefix
  • vm_gw: VM primary network card gateway
  • vm_dns: VM DNS IP address
  • rhel_7_path: RHEL 7 cloud image path in the KVM HOST
  • rhel_8_path: RHEL 8 cloud image path in the KVM HOST
  • centos_7_path: CentOS 7 cloud image url to download from
  • centos_8_path: CentOS 8 cloud image url to download from
  • ubuntu_18_path: Ubuntu 18 cloud image url to download from
  • ubuntu_20_path: Ubuntu 20 cloud image url to download from
  • vm_root_password: VM root password
  • vm_user: Default User to create
  • vm_authorized_ssh: Public ssh key to copy to the VM

Example Playbook

- hosts: KVMHost
  roles:
     - role:
          name: hosninabil.kvmLinuxvm
       vars:
          dist: "centos"
          version: "8"
          vm_cpu: 1
          vm_memory: 2048
          vm_network: default
          vm_user: nabil
          vm_ip: 10.112.42.106
          vm_prefix: 24
          vm_gw: 10.112.42.254
          vm_dns: 8.8.8.8

License

Apache License 2.0

Author Information

Nabil Hosni, cloud engineer and opensource enthusiast.

About

Ansible role to provision a Linux virtual machine on a KVM host

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published