RedHatGov.kvm_vm
kvm-vm
Create a Virtual Machine (VM) on a RHEL+KVM hypervisor.
Requirements
- You need a working RHEL+KVM hypervisor.
- Can use either physical virtualization or nested virtualization.
Role Variables
Variable | Required | Default | Description |
---|---|---|---|
kvm_vm_hostname |
:heavy_check_mark: | The Fully Qualified Domain Name (FQDN) for the VM | |
kvm_vm_public_ip |
:heavy_check_mark: | The public IP address for the VM that can be reached | |
kvm_vm_root_pwd |
:heavy_check_mark: | Password for the root user of the VM | |
kvm_vm_base_img |
:heavy_check_mark: | Name of the base image in /var/lib/libvirt/images on the KVM hypervisor | |
kvm_vm_vcpus |
:x: | 1 |
Number of virtual CPUs to assign to the VM |
kvm_vm_ram |
:x: | 1024 |
Amount of RAM for the VM in megabytes |
kvm_vm_os_disk_name |
:x: | {{ kvm_vm_hostname }} |
Name of the operating system disk in /var/lib/libvirt/images |
kvm_vm_os_disk_size |
:x: | 10G |
Size of the operating system disk for the VM |
kvm_vm_nics |
:heavy_check_mark: | see example playbook |
List of Network Interface Cards (NICs) to create for the VM |
Dependencies
None
Example Playbook
- hosts: kvm
tags: provision
vars:
kvm_vm_hostname: "vm1.example.com"
kvm_vm_public_ip: 192.168.122.10
kvm_vm_root_pwd: "p@ssw0rd"
kvm_vm_base_img: rhel-guest-image-7.qcow2
kvm_vm_vcpus: "2"
kvm_vm_ram: "4096"
kvm_vm_os_disk_name: "{{ kvm_vm_hostname }}"
kvm_vm_os_disk_size: "10G"
kvm_vm_nics:
- name: eth0
bootproto: static
onboot: yes
ip: "{{ kvm_vm_public_ip }}"
prefix: "24"
gateway: "192.168.122.1"
dns_server: "192.168.122.1"
config: "--type network --source default --model virtio"
tasks:
- name: Create KVM VM
include_role:
name: RedHatGov.kvm-vm
License
GPLv3
Author Information
Installa
ansible-galaxy install RedHatGov.kvm_vm
Licenza
gpl-3.0
Download
253
Proprietario
Code contributions from Red Hat's Public Sector practice