forked from astolzen/ansible_vmcreator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vm_xml.j2
69 lines (69 loc) · 2.33 KB
/
vm_xml.j2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<domain type='kvm'>
<name>{{ item.key }}</name>
<memory unit='KiB'>{{ item.value.mem }}</memory>
<vcpu placement='static'>{{ item.value.cpu }}</vcpu>
<os>
<type arch='x86_64' machine='{{ qemu.machine }}'>hvm</type>
<boot dev='hd'/>
</os>
<!--
<cpu mode='host-model'>
<model fallback='allow'/>
</cpu>
-->
<cpu mode='custom' match='exact'>
<model>SandyBridge</model>
<feature policy='require' name='vmx'/>
</cpu>
<devices>
<emulator>/usr/bin/qemu-kvm</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='{{ vmdir }}{{ item.key }}.qcow2'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
</disk>
{% if item.value.addisk is defined %}
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='{{ vmdir }}{{ item.key }}_addisk.qcow2'/>
<target dev='vdb' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
</disk>
{% endif %}
<interface type='network'>
<mac address='{{ vmnet.basemac }}:{{ item.value.mac }}'/>
<source network='default'/>
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<serial type='pty'>
<target port='0'/>
</serial>
<console type='pty'>
<target type='serial' port='0'/>
</console>
<channel type='spicevmc'>
<target type='virtio' name='com.redhat.spice.0'/>
<address type='virtio-serial' controller='0' bus='0' port='2'/>
</channel>
<input type='tablet' bus='usb'/>
<input type='mouse' bus='ps2'/>
<input type='keyboard' bus='ps2'/>
<graphics type='spice' autoport='yes'/>
<sound model='ich6'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</sound>
<video>
<model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<redirdev bus='usb' type='spicevmc'>
</redirdev>
<redirdev bus='usb' type='spicevmc'>
</redirdev>
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
</memballoon>
</devices>
</domain>