
KVM / Libvirt CreateVm
CertifiedCreate or update KVM domain
KVM / Libvirt CreateVm
Create or update KVM domain
Defines a libvirt domain from rendered XML, creating it if it doesn't exist and keeping configuration in sync. Can optionally boot the VM when startAfterCreate is true (default false); requires access to the target libvirt URI.
type: io.kestra.plugin.kvm.CreateVmExamples
id: crea_kvm_vm_ssh
namespace: kvmtest.ssh
tasks:
- id: create_vm
type: io.kestra.plugin.kvm.CreateVm
# Replace with your Droplet IP.
# ?no_verify=1 skips the 'known_hosts' check for the first run.
uri: qemu+ssh://root@167.99.104.163/system
# This is the standard Libvirt XML format
xmlDefinition: |
<domain type='kvm'>
<name>kestra-worker-nodes</name>
<memory unit='MiB'>512</memory>
<vcpu placement='static'>1</vcpu>
<os>
<type arch='x86_64' machine='pc-q35-6.2'>hvm</type>
<boot dev='hd'/>
</os>
<devices>
<disk type='volume' device='disk'>
<driver name='qemu' type='qcow2'/>
<source pool='default' volume='kestra-worker-nodes-os.qcow2'/>
<target dev='vda' bus='virtio'/>
</disk>
<disk type='volume' device='disk'>
<driver name='qemu' type='qcow2'/>
<source pool='default' volume='kestra-worker-nodes-data.qcow2'/>
<target dev='vdb' bus='virtio'/>
</disk>
</devices>
</domain>
# If true, it attempts to boot the VM immediately after defining it
startAfterCreate: true
- id: log_result
type: io.kestra.plugin.core.log.Log
message: |
VM Created!
Name: {{outputs.create_vm.name}}
UUID: {{ outputs.create_vm.uuid }}
State: {{ outputs.create_vm.state }}
Properties
name *string
Domain name
VM name used for lookup and definition; should match the
xmlDefinition *string
Domain XML
Full libvirt domain XML template rendered with flow variables before being sent to defineXML.
assets
Assets this task consumes as inputs or produces as outputs, for lineage tracking and the asset graph (Enterprise Edition). A flow declaring this property on a task is rejected in the open-source edition.
io.kestra.core.models.assets.AssetsDeclaration
IGNOREFAILWARNAsset failure behavior
Behavior applied to the task state when a declared asset fails to render, emit, or be persisted (e.g. a lock conflict): FAIL escalates it to FAILED, WARN (default) warns it if it would otherwise succeed, IGNORE leaves the state untouched.
Whether to auto-register assets referenced dynamically at runtime that are not statically declared in inputs or outputs.
The assets consumed as inputs.
io.kestra.core.models.assets.AssetIdentifier
1The assets produced as outputs.
io.kestra.plugin.ee.assets.Dataset
1150{}1150io.kestra.plugin.ee.assets.File
1150{}1150io.kestra.plugin.ee.assets.Table
1150{}1150io.kestra.plugin.ee.assets.VM
1150{}1150io.kestra.core.models.assets.External
1150{}1150io.kestra.core.models.assets.Custom
11501Custom asset type
{}1150startAfterCreate booleanstring
falseStart after define
If true, boots the VM after definition when it isn't already running. Default false.
uri string
Libvirt URI
Outputs
name string
VM Name
Defined domain name.
state string
VM State
Libvirt domain state after definition and optional start.
uuid string
VM UUID
Persistent libvirt UUID of the domain.