siavashoutadi.virt_guest
Role Name
An Ansible role to create virtual machines on KVM.
Requirements
You need to have Libvirt installed.
Role Variables
# Name of the virtual machine
virt_guest_name: "vm1"
# Number of CPU cores
virt_guest_vcpus: 1
# Unit for memory. Use GB or MB
virt_guest_memory_unit: "GB"
# Amount of memory
virt_guest_memory: 2
# List of disks to add
# Format:
# - path: /var/lib/libvirt/images/
# size: SIZE in MB
virt_guest_disks: []
# Owner and group for the disk files
virt_guest_disks_owner: qemu
virt_guest_disks_group: qemu
# List of networks to connect to
# Format:
# - NET_NAME
virt_guest_networks: []
# Path to ISO file to attach to CD-ROM
virt_guest_iso: ""
Dependencies
None
Example Playbook
- name: Create a virtual guest
hosts: hypervisor
become: yes
vars:
virt_guest_name: vm1
virt_guest_disks:
- path: /var/kvm-images
size: 20480
virt_guest_networks:
- virbr1
virt_guest_iso: /tmp/iso/centos.iso
roles:
- role: siavashoutadi.virt_guest
License
Apache