1
0
IaC/ansible/roles/vm_deploy/templates/vm_template.xml.j2

99 lines
3.4 KiB
Plaintext
Raw Normal View History

2022-10-23 09:54:34 -04:00
<domain type='kvm'>
2022-10-24 05:53:50 -04:00
<name>{{ vm_name }}</name>
2022-10-23 09:54:34 -04:00
<metadata>
<libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
<libosinfo:os id="http://archlinux.org/archlinux/rolling"/>
</libosinfo:libosinfo>
</metadata>
<memory unit='GiB'>{{ vm_memory }}</memory>
<currentMemory unit='GiB'>{{ vm_memory }}</currentMemory>
<vcpu placement='static'>{{ vm_cpu }}</vcpu>
<resource>
<partition>/machine</partition>
</resource>
<os>
2022-10-30 05:18:55 -04:00
<type arch='{{ vm_machine_arch }}' machine='{{ vm_machine_type }}'>hvm</type>
2022-10-23 09:54:34 -04:00
<loader readonly='yes' secure='yes' type='pflash'>/usr/share/edk2-ovmf/x64/OVMF_CODE.secboot.fd</loader>
2022-10-30 05:24:26 -04:00
<nvram template='/usr/share/edk2-ovmf/x64/OVMF_VARS.fd'>{{ firmware_vhd_pool_dir }}/{{ vm_name }}_VARS.fd</nvram>
2022-10-23 09:54:34 -04:00
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<vmport state='off'/>
<smm state='on'/>
</features>
<cpu mode='host-passthrough' check='none' migratable='on'>
2022-10-30 05:18:55 -04:00
<topology sockets='1' dies='1' cores='{{ vm_cpu_cores }}' threads='{{ vm_cpu_threads }}'/>
2022-10-23 09:54:34 -04:00
</cpu>
<clock offset='utc'>
<timer name='rtc' tickpolicy='catchup'/>
<timer name='pit' tickpolicy='delay'/>
<timer name='hpet' present='no'/>
</clock>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<pm>
<suspend-to-mem enabled='no'/>
<suspend-to-disk enabled='no'/>
</pm>
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
2022-10-24 05:53:50 -04:00
<source file='{{ root_vhd_pool_dir }}/{{ vm_name }}_vda.qcow2'/>
2022-10-23 09:54:34 -04:00
<target dev='vda' bus='virtio'/>
<boot order='1'/>
</disk>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
2022-10-24 05:53:50 -04:00
<source file='{{ containers_vhd_pool_dir }}/{{ vm_name }}_vdb.qcow2'/>
2022-10-23 09:54:34 -04:00
<target dev='vdb' bus='virtio'/>
</disk>
2022-10-29 09:39:44 -04:00
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='{{ data_nvme_vhd_pool_dir }}/{{ vm_name }}_vdc.qcow2'/>
<target dev='vdc' bus='virtio'/>
</disk>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='{{ data_hdd_vhd_pool_dir }}/{{ vm_name }}_vdd.qcow2'/>
<target dev='vdd' bus='virtio'/>
</disk>
2022-10-23 09:54:34 -04:00
<controller type='usb' index='0' model='qemu-xhci' ports='15'/>
<controller type='sata' index='0'/>
<controller type='virtio-serial' index='0'/>
<interface type='bridge'>
2022-10-30 05:18:55 -04:00
<mac address='{{ vm_mac_prefix }}{{ vm_number }}'/>
2022-10-23 09:54:34 -04:00
<source bridge='{{ vm_bridge }}'/>
<model type='virtio'/>
</interface>
<serial type='pty'>
<source path='/dev/pts/2'/>
<target type='isa-serial' port='0'>
<model name='isa-serial'/>
</target>
</serial>
<console type='pty' tty='/dev/pts/2'>
<source path='/dev/pts/2'/>
<target type='serial' port='0'/>
</console>
<channel type='unix'>
<target type='virtio' name='org.qemu.guest_agent.0'/>
<address type='virtio-serial' controller='0' bus='0' port='1'/>
</channel>
<input type='tablet' bus='usb'>
<address type='usb' bus='0' port='1'/>
</input>
<input type='mouse' bus='ps2'/>
<input type='keyboard' bus='ps2'/>
<memballoon model='virtio' autodeflate='on' freePageReporting='on'>
<stats period='5'/>
</memballoon>
<rng model='virtio'>
<backend model='random'>/dev/urandom</backend>
</rng>
</devices>
</domain>