community.libvirt.virt_install module – Provision new virtual machines using virt-install tool
Note
This module is part of the community.libvirt collection (version 2.0.0).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install community.libvirt
.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: community.libvirt.virt_install
.
New in community.libvirt 2.0.0
Synopsis
Create and install virtual machines using
virt-install
with a declarative configuration.
Requirements
The below requirements are needed on the host that executes this module.
libvirt python bindings
lxml
python >= 2.6
virt-install
Parameters
Parameter |
Comments |
---|---|
Request a non-native CPU architecture for the guest virtual machine. If omitted, the host CPU architecture will be used in the guest. |
|
Configure host audio output for the guest’s sound hardware. The dictionary contains key/value pairs that define individual audio backend properties. |
|
Configure multiple audio backends for the guest. |
|
Set the autostart flag for a domain. Choices:
|
|
Tune block I/O policy for the domain process. |
|
Tune the weights for individual host block device used by the guest. Each dictionary entry contains a property name and its corresponding value. |
|
The overall I/O weight of the guest. The value should be in the range [100, 1000]. After kernel 2.6.39, the value could be in the range [10, 1000]. |
|
Set the boot device priority for post-install configuration. |
|
Additional options for boot configuration. The dictionary contains key/value pairs that define individual boot options. |
|
ISO file or CDROM device to use for VM install media. |
|
Attach a communication channel device to connect the guest and host machine. The dictionary contains key/value pairs that define individual channel properties. |
|
Configure multiple channel devices for the guest. |
|
Configure the clock for the guest. |
|
Set the clock offset, e.g. |
|
Tweak the guest’s timer settings on the specific hypervisor. Each dictionary entry contains a property name and its corresponding value. |
|
Pass cloud-init metadata to the VM. A cloud-init NoCloud ISO file is generated, and attached to the VM as a CDROM device. |
|
Specify a public key file to inject into the guest, providing ssh access to the default cloud-init user account. |
|
Disable cloud-init in the VM for subsequent boots. Without this, cloud-init may reset auth on each boot. Choices:
|
|
Specify a cloud-init meta-data file content. |
|
Specify a cloud-init network-config file content. |
|
A file used to set the VM root password from. |
|
Generate a new root password for the VM. Choices:
|
|
Specify a public key file to inject into the guest. |
|
Specify a cloud-init user-data file content. |
|
Connect a text console between the guest and host. The dictionary contains key/value pairs that define individual console properties. Common properties include type and target for different console types. |
|
Configure multiple console devices for the guest. |
|
This guest should be a container type guest. Choices:
|
|
Attach a controller device to the guest. The dictionary contains key/value pairs that define individual controller properties. Examples include type=usb,model=none to disable USB, or type=scsi,model=virtio-scsi for VirtIO SCSI. |
|
Configure multiple controller devices for the guest. |
|
Configure the CPU model and CPU features exposed to the guest. |
|
vCPU cache configuration for the guest. |
|
Specify the level of CPU cache. |
|
If set to If set to If set to Choices:
|
|
Fine-tune features provided by the selected CPU model. The value should be a dictionary where each key is a feature name and the value is a dictionary of options for that feature. An empty object |
|
The policy for the CPU feature. If set to If set to If set to If set to If set to Choices:
|
|
Specify how strictly the CPU model should be matched. Choices:
|
|
Specify whether this CPU model is migratable. Choices:
|
|
A valid CPU model or configuration mode for the guest. The possible values include: |
|
Additional options for CPU model configuration. |
|
Specify whether to automatically fall back to the closest model supported by the hypervisor if unable to use the exact CPU model. Choices:
|
|
Set the vendor id seen by the guest. It must be exactly 12 characters long. Typical possible values are AuthenticAMD and GenuineIntel. |
|
Configure NUMA topology for the guest. |
|
Specify a NUMA cell configuration. |
|
Describe memory side cache for memory proximity domains. Each dictionary entry contains a property name and its corresponding value. |
|
Specify the CPU or range of CPUs that are part of this node. |
|
Fine tune the discard feature for given NUMA node. Choices:
|
|
Define the distance between NUMA cells. |
|
Specify the distance value between sibling NUMA cells. Each dictionary entry contains a property name and its corresponding value. |
|
Specify the NUMA node ID. |
|
Specify the memory access mode for the NUMA node. This is valid only for hugepages-backed memory and nvdimm modules. Choices:
|
|
Specify the node memory size with a unit suffix. |
|
Describes the normalized memory read/write latency and bandwidth between Initiator Proximity Domains and Target Proximity Domains. |
|
Describe bandwidth between two memory nodes. Each dictionary entry contains a property name and its corresponding value. |
|
Describe latency between two memory nodes. Each dictionary entry contains a property name and its corresponding value. |
|
Specify CPU vendor requested by the guest The list of supported vendors can be found in cpu_map/*_vendors.xml. |
|
Tune CPU parameters for the guest. |
|
Specify the enforcement interval (unit: microseconds) for domain’s emulator threads. |
|
Specify the maximum allowed bandwidth (unit: microseconds) for domain’s emulator threads. |
|
Specify which host CPUs the domain emulator will be pinned to. |
|
Specify which physical CPUs to pin to. |
|
Specify the scheduler type for emulator thread. |
|
For real-time schedulers (fifo, rr), priority must be specified as well (and is ignored for non-real-time ones). The value range for the priority depends on the host kernel (usually 1-99). |
|
The scheduler type. Choices:
|
|
Specify the enforcement CFS scheduler interval (unit: microseconds) for the whole domain. |
|
Specify the maximum allowed bandwidth (unit: microseconds) within a period for the whole domain. |
|
Specify the enforcement interval (unit: microseconds) for domain’s IOThreads. |
|
Specify the maximum allowed bandwidth (unit: microseconds) for domain’s IOThreads. |
|
Specify which of host physical CPUs the IOThreads will be pinned to. |
|
Specify which physical CPUs to pin to. |
|
Specify the IOThread ID. |
|
Specify the scheduler type for particular IOThreads. |
|
Select which IOThreads this setting applies to. |
|
For real-time schedulers (fifo, rr), priority must be specified as well (and is ignored for non-real-time ones). The value range for the priority depends on the host kernel (usually 1-99). |
|
The scheduler type. Choices:
|
|
Specify the enforcement interval (unit: microseconds). The value should be in range [1000, 1000000]. A period with value 0 means no value. |
|
Specify the maximum allowed bandwidth (unit: microseconds). A domain with quota as any negative value indicates that the domain has infinite bandwidth for vCPU threads. |
|
Specify the proportional weighted share for the domain. |
|
Specify which of host’s physical CPUs the domain vCPU will be pinned to |
|
A comma-separated list of physical CPU numbers. |
|
Specify the vCPU ID. |
|
Specify the scheduler type for particular vCPUs. |
|
For real-time schedulers (fifo, rr), priority must be specified as well (and is ignored for non-real-time ones). The value range for the priority depends on the host kernel (usually 1-99). |
|
The scheduler type. Choices:
|
|
Select which vCPUs this setting applies to. |
|
If set to Choices:
|
|
Specify the storage devices for the guest. |
|
Specify the controller properties where the disk should be attached. The dictionary contains key/value pairs that define individual properties. |
|
Disk image format of backing_store. |
|
Path to a disk to use as the backing store for the newly created image. |
|
Override the default block device properties for the disk. The dictionary contains key/value pairs that define individual properties. |
|
Specify the boot order for the disk device. The dictionary contains key/value pairs that define individual properties. The per-device boot elements cannot be used together with general boot elements in the OS bootloader section. |
|
Disk bus type. (e.g. |
|
The cache mode to be used. Choices:
|
|
Specify the details of the hypervisor disk driver. The dictionary contains key/value pairs that define individual properties. |
|
Disk image format. For file volumes, this can be |
|
Override geometry settings for the disk. The dictionary contains key/value pairs that define individual properties. |
|
Specify additional per-device I/O tuning. The dictionary contains key/value pairs that define individual properties. |
|
The path to some storage media to use, existing or not. |
|
An existing libvirt storage pool name to create new storage on. |
|
Specify whether the disk needs rawio capability. Choices:
|
|
Set drive as readonly Choices:
|
|
Serial number of the emulated disk device. |
|
Specify whether unprivileged SG_IO commands are filtered for the disk. Only available when the device is ‘lun’. Choices:
|
|
Set drive as shareable Choices:
|
|
The size (in GiB) to use if creating new storage. |
|
Indicates the default behavior of the disk during disk snapshots. Choices:
|
|
Specify the details of the disk source. The dictionary contains key/value pairs that define individual properties. |
|
Whether to skip fully allocating newly created storage. Choices:
|
|
Specify the details of the target disk device. The dictionary contains key/value pairs that define individual properties. |
|
If Choices:
|
|
Additional options for transient disk configuration. |
|
If Choices:
|
|
An existing libvirt storage volume to use. |
|
Specify events values for the guest. |
|
Action to take when the guest crashes. Choices:
|
|
Action to take when when a lock manager loses resource locks. Choices:
|
|
Action to take when the guest requests a poweroff. Choices:
|
|
Action to take when the guest requests a reboot. Choices:
|
|
Additional kernel command line arguments to pass to the installer when performing a guest install with |
|
Enable or disable certain machine features. The value should be a dictionary where each key is a feature name and the value is a dictionary of options for that feature. An empty object Example: |
|
Specifies directories on the host to export to the guest. |
|
Specify the security mode for accessing the source. Choices:
|
|
Specify the controller properties where the filesystem should be attached. The dictionary contains key/value pairs that define individual properties. |
|
Tune the options for virtiofsd. The dictionary contains key/value pairs that define individual properties. |
|
The creation mode for directories when used with the |
|
Specify the details of the hypervisor driver. The dictionary contains key/value pairs that define individual properties. |
|
The creation mode for files when used with the |
|
Specify how to deal with a filesystem export containing more than one device. Choices:
|
|
Enable exporting filesystem as a readonly mount for guest. Choices:
|
|
The source directory configuration on the host. The dictionary contains key/value pairs that define individual properties. |
|
Maximum space available to this guest’s filesystem |
|
Maximum space available to this guest’s filesystem. |
|
The mount target configuration in the guest. The dictionary contains key/value pairs that define individual properties. |
|
Specify the source type of the filesystem. Choices:
|
|
Configure the graphical display for the guest virtual machine. The dictionary contains key/value pairs that define individual properties. Common properties include type (e.g. |
|
Configure multiple graphics devices for the guest. |
|
Configure multiple host devices for the guest. |
|
Attach a physical host device to the guest. The dictionary contains key/value pairs that define individual host device properties. |
|
Request the use of full virtualization. Choices:
|
|
Configure the UID or GID mapping for the guest. |
|
The GID mapping configuration. |
|
How many groups in container are allowed to map to host’s user. |
|
First group ID in container. |
|
The first group ID in container will be mapped to this target user ID in host. |
|
The UID mapping configuration. |
|
How many users in container are allowed to map to host’s user. |
|
First user ID in container. |
|
The first user ID in container will be mapped to this target user ID in host. |
|
Skip the OS installation process, and build a guest around an existing disk image. Choices:
|
|
Add PATH to the root of the initrd fetched with |
|
Attach an input device to the guest. Input device types include mouse, tablet, or keyboard. The dictionary contains key/value pairs that define individual input device properties. |
|
Configure multiple input devices for the guest. |
|
Additional options for the installation. This option is strictly for VM install operations, essentially configuring the first boot. |
|
Specify the install bootdev to boot for the install phase. |
|
Specify a kernel and initrd pair to use as install media. |
|
Specify a kernel and initrd pair to use as install media. |
|
Specify the installation-time kernel arguments. |
|
Override the virt-install default kernel arguments rather than appending to them. Choices:
|
|
Tell virt-install that there isn’t actually any install happening, and you just want to create the VM. Choices:
|
|
The OS name from libosinfo, e.g. |
|
Add an IOMMU device to the guest. The dictionary contains key/value pairs that define individual IOMMU properties. |
|
Configure multiple IOMMU devices for the guest. |
|
Number of I/O threads to configure for the guest. |
|
Additional options for I/O threads configuration. |
|
Provide the capability to define the default event loop within hypervisor. |
|
Set upper boundary for number of worker threads for given IOThread. |
|
Set lower boundary for number of worker threads for given IOThread. |
|
Provide the capability to specifically define the IOThread ID’s for the domain. |
|
Define the IOThread ID. |
|
Set upper boundary for number of worker threads for given IOThread. |
|
Set lower boundary for number of worker threads for given IOThread. |
|
Configure domain keywrap settings used for S390 cryptographic key management operations. |
|
Specify the cipher settings for the domain. Each dictionary entry contains a property name and its corresponding value. |
|
Enable launch security for the guest. |
|
The C-bit (aka encryption bit) location in guest page table entry. |
|
The guest owners base64 encoded Diffie-Hellman (DH) key. |
|
The guest policy which must be maintained by the SEV firmware, e.g. |
|
The physical address bit reduction, e.g. |
|
The guest owners base64 encoded session blob defined in the SEV API spec. |
|
The type of launch security to enable, e.g. |
|
The installation source, which can be a URL or a directory path containing the OS distribution installation media. |
|
Additional options for the installation source. |
|
The initrd path relative to the specified location. |
|
The kernel path relative to the specified location. |
|
The machine type to emulate. This will typically not need to be specified for Xen or KVM. |
|
Attach a virtual memory balloon device to the guest. The dictionary contains key/value pairs that define individual memory balloon properties. Common properties include model (e.g. |
|
Configure multiple memory balloon devices for the guest. |
|
Memory to allocate for the guest, in MiB. |
|
Additional options for memory allocation. |
|
The actual allocation of memory for the guest, in MiB. |
|
The run time maximum memory allocation of the guest, in MiB. |
|
Additional options for maximum memory configuration. |
|
The number of slots available for adding memory to the guest. |
|
Specify how virtual memory pages are backed by host pages |
|
Configure memory access permissions. |
|
The access mode for the memory. Choices:
|
|
Configure memory allocation behavior. |
|
Specify when to allocate the memory by supplying either Choices:
|
|
The number of threads that hypervisor uses to allocate memory. |
|
If set to Choices:
|
|
Configure hugepage specifications for memory backing. |
|
Specify the guest’s NUMA nodes to certain hugepage sizes. |
|
Specify the hugepage size with a unit suffix. |
|
Use huge pages for memory backing. Choices:
|
|
Memory pages will be locked in host’s memory and will not be swapped out. Choices:
|
|
Instructs hypervisor to disable shared pages (memory merge, KSM) for this domain. Choices:
|
|
Tune memory policy for the domain process. The dictionary contains key/value pairs that define individual memtune entries. |
|
Specify the metadata for the guest virtual machine. The dictionary contains key/value pairs that define individual metadata entries. e.g. Use |
|
Name of the new guest virtual machine instance. |
|
Connect the guest to the host network. Empty list |
|
Specify the controller properties where the filesystem should be attached. The dictionary contains key/value pairs that define individual properties. |
|
Specify the boot order for the network interface. The dictionary contains key/value pairs that define individual properties. The per-device boot elements cannot be used together with general boot elements in the OS bootloader section. |
|
Name of the host bridge device to connect to. |
|
Specify the details of the hypervisor driver. The dictionary contains key/value pairs that define individual properties. |
|
Configure network traffic filter rules for the guest. The dictionary contains key/value pairs that define individual properties. |
|
Name of the host device to connect to for type=hostdev. This uses PCI passthrough to directly assign a network device. |
|
MAC address configuration for the network interface. |
|
Fixed MAC address for the guest interface. If not specified, a suitable address will be randomly generated. |
|
Network device model configuration. |
|
Network device model as seen by the guest. Examples include |
|
Configure MTU settings for the virtual network link. - The dictionary contains key/value pairs that define individual properties. |
|
Name of the libvirt virtual network to connect to. |
|
Specify the interface ROM BIOS configuration The dictionary contains key/value pairs that define individual properties. |
|
Specify the details of the source network interface. The dictionary contains key/value pairs that define individual properties. |
|
Set state of the virtual network link The dictionary contains key/value pairs that define individual properties. |
|
Specify the details of the target network device. The dictionary contains key/value pairs that define individual properties. |
|
When set to Choices:
|
|
The type of network interface.
If omitted, the type of network interface is determined by other options. Choices:
|
|
Configure virtual port settings for the network interface. The dictionary contains key/value pairs that define individual properties. Common properties include type (e.g. |
|
If set to Choices:
|
|
Tune NUMA policy for the domain process. |
|
Specify memory allocation policies per each guest NUMA node. |
|
Specify the NUMA node ID. |
|
Can be one of Choices:
|
|
Specifies the NUMA nodes to allocate memory from. |
|
Specifies how to allocate memory for the domain process on a NUMA host. |
|
Can be one of Choices:
|
|
Specifies the NUMA nodes to allocate memory from. |
|
Indicate the memory placement mode for domain process. Choices:
|
|
Optimize the guest configuration for a specific operating system. |
|
Whether Choices:
|
|
The full URL style libosinfo ID. |
|
The OS name from libosinfo. (e.g. |
|
Whether Choices:
|
|
Attach a panic notifier device to the guest. The dictionary contains key/value pairs that define individual panic device properties. |
|
Configure multiple panic devices for the guest. |
|
Attach a parallel device to the guest. The dictionary contains key/value pairs that define individual parallel device properties. |
|
Configure multiple parallel devices for the guest. |
|
This guest should be a paravirtualized guest. Choices:
|
|
Configure the power management for the guest. |
|
Configure BIOS support for S4 (suspend-to-disk) ACPI sleep states. |
|
Enable or disable this sleep state. Choices:
|
|
Configure BIOS support for S3 (suspend-to-mem) ACPI sleep states. |
|
Enable or disable this sleep state. Choices:
|
|
Install the guest from PXE. Choices:
|
|
Pass options directly to the qemu emulator. Only works for the libvirt qemu driver. |
|
Use with present to force the re-creation of an existing VM. Choices:
|
|
Add a redirected device for USB or other device redirection. The dictionary contains key/value pairs that define individual redirection properties. Common properties include bus=usb, type=tcp or type=spicevmc. |
|
Configure multiple redirected devices for the guest. |
|
Specify resource partitioning for the guest. The dictionary contains key/value pairs that define individual resource entries. Use |
|
Configure a virtual random number generator (RNG) device. The dictionary contains key/value pairs that define individual RNG properties. |
|
Configure multiple RNG devices for the guest. |
|
Configure domain seclabel domain settings. The dictionary contains key/value pairs that define individual security entries. |
|
Attach a serial device to the guest with various redirection options. The dictionary contains key/value pairs that define individual serial device properties. |
|
Configure multiple serial devices for the guest. |
|
Attach a shared memory device to the guest. The dictionary contains key/value pairs that define individual shared memory properties. |
|
Configure multiple shared memory devices for the guest. |
|
Configure a virtual smartcard device. The dictionary contains key/value pairs that define individual smartcard properties. |
|
Configure multiple smartcard devices for the guest. |
|
Attach a virtual audio device to the guest. The dictionary contains key/value pairs that define individual sound device properties. Common properties include model (e.g. |
|
Configure multiple sound devices for the guest. |
|
If set to If set to Choices:
|
|
Configure sysinfo/SMBIOS values exposed to the VM OS. The dictionary contains key/value pairs that define individual sysinfo entries. Use |
|
Configure a virtual TPM (Trusted Platform Module) device. The dictionary contains key/value pairs that define individual TPM properties. |
|
Configure multiple TPM devices for the guest. |
|
If set to Choices:
|
|
Perform an unattended install using libosinfo’s install script support. |
|
A file used to set the VM OS admin/root password from. |
|
Set a Windows product key. |
|
Choose which libosinfo unattended profile to use. |
|
The user login name to be used in the VM. |
|
A file used to set the VM user password. |
|
Libvirt connection uri. Default: |
|
Number of virtual cpus to configure for the guest. |
|
Additional options for virtual CPU configuration. |
|
number of clusters per die |
|
Number of cores per cluster |
|
A comma-separated list of physical CPU numbers that domain process and virtual CPUs can be pinned to by default. |
|
Specify whether fewer than the maximum number of virtual CPUs should be enabled. |
|
Number of dies per socket |
|
If specified, the guest will be able to hotplug up to MAX vcpus while the guest is running. |
|
Indicate the CPU placement mode for domain process Choices:
|
|
Total number of CPU sockets |
|
Number of threads per core |
|
Configure individual vCPU properties. Each dictionary entry contains a property name and its corresponding value. |
|
Specify what video device model will be attached to the guest. The dictionary contains key/value pairs that define individual video device properties. |
|
Configure multiple video devices for the guest. |
|
The hypervisor used to create the VM guest. Example choices are |
|
Configure a vsock host/guest interface. The dictionary contains key/value pairs that define individual vsock properties. |
|
Configure multiple vsock devices for the guest. |
|
Attach a virtual hardware watchdog device to the guest. The dictionary contains key/value pairs that define individual watchdog properties. |
|
Configure multiple watchdog devices for the guest. |
Attributes
Attribute |
Support |
Description |
---|---|---|
Support: full |
Supports check_mode. |
Notes
Note
The
virt-install
command is provided by different packages on different distributions.On Debian/Ubuntu, install the
virtinst
package.On RHEL/CentOS/Fedora and openSUSE, install the
virt-install
package.
See Also
See also
- virt-install Man Page
Ubuntu manpage of virt-install tool.
Examples
# Basic VM creation with Fedora installation
- name: Create a basic Fedora VM
community.libvirt.virt_install:
name: my-fedora-vm
memory: 2048
vcpus: 2
disks:
- size: 20
osinfo:
name: fedora39
location: https://download.fedoraproject.org/pub/fedora/linux/releases/39/Server/x86_64/
graphics:
type: spice
networks:
- network: default
# Windows 10 VM with CDROM installation
- name: Create Windows 10 VM
community.libvirt.virt_install:
name: my-win10-vm
memory: 4096
vcpus: 4
disks:
- size: 40
format: qcow2
osinfo:
name: win10
cdrom: /path/to/my/win10.iso
graphics:
type: vnc
password: mypassword
networks:
- network: default
model:
type: e1000
# Import existing disk image
- name: Import existing Debian VM
community.libvirt.virt_install:
name: my-debian-vm
memory: 1024
vcpus: 2
disks:
- path: /home/user/VMs/my-debian9.img
osinfo:
name: debian9
import: true
networks:
- bridge: br0
# CentOS installation with custom storage and network configuration
- name: Create CentOS VM with custom configuration
community.libvirt.virt_install:
name: centos-server
memory: 8192
vcpus: 8
disks:
- pool: default
size: 50
format: qcow2
cache: writeback
- pool: default
size: 100
format: qcow2
bus: virtio
osinfo:
name: centos7.0
location: http://mirror.centos.org/centos-7/7/os/x86_64/
extra_args: "ks=http://myserver/centos7.ks"
graphics:
type: vnc
listen: 0.0.0.0
port: 5901
networks:
- bridge: br0
model:
type: virtio
- network: isolated-net
# Ubuntu server with unattended installation
- name: Create Ubuntu server with unattended install
community.libvirt.virt_install:
name: ubuntu-server
memory: 2048
vcpus: 2
disks:
- size: 25
osinfo:
name: ubuntu20.04
location: http://archive.ubuntu.com/ubuntu/dists/focal/main/installer-amd64/
unattended:
profile: jeos
admin_password_file: /tmp/root_password
user_login: ansible
user_password_file: /tmp/user_password
networks:
- network: default
# ARM VM with custom kernel
- name: Create ARM VM with custom kernel
community.libvirt.virt_install:
name: arm-test-vm
memory: 1024
vcpus: 2
arch: armv7l
machine: vexpress-a9
disks:
- path: /home/user/VMs/myarmdisk.img
boot:
kernel: /tmp/my-arm-kernel
initrd: /tmp/my-arm-initrd
dtb: /tmp/my-arm-dtb
kernel_args: "console=ttyAMA0 rw root=/dev/mmcblk0p3"
graphics:
type: none
networks:
- network: default
# VM with SEV launch security (AMD)
- name: Create SEV-enabled VM
community.libvirt.virt_install:
name: sev-vm
memory: 4096
memtune:
hard_limit: 4563402
vcpus: 4
machine: q35
boot: uefi
disks:
- size: 15
bus: scsi
controller_devices:
- type: scsi
model: virtio-scsi
driver:
iommu: "on"
- type: virtio-serial
driver:
iommu: "on"
networks:
- network: default
model:
type: virtio
driver:
iommu: "on"
rng:
backend:
type: random
source: /dev/random
driver:
iommu: "on"
memballoon:
model: virtio
driver:
iommu: "on"
launch_security:
type: sev
policy: "0x01"
osinfo:
name: fedora39
import: true
# Recreate existing VM
- name: Recreate existing VM with new configuration
community.libvirt.virt_install:
name: existing-vm
state: present
recreate: true
memory: 4096
vcpus: 4
disks:
- size: 40
osinfo:
name: fedora39
cdrom: /path/to/fedora39.iso
networks:
- network: default
# Remove VM
- name: Remove VM
community.libvirt.virt_install:
name: unwanted-vm
state: absent