2 <name>{{ inventory_hostname }}</name>
3 <memory>{{ vm_install.mem * 1024 }}</memory>
4 <currentMemory>{{ vm_install.mem * 1024 }}</currentMemory>
5 <vcpu>{{ vm_install.numcpu }}</vcpu>
7 <type arch='x86_64' machine='pc-0.12'>hvm</type>
9 <kernel>{{ hostvars[vm_install.host].vm_host.installer.path }}/{{ vmdistro }}-{{ vmdistcodename }}/{{ vm_install.arch | default('amd64') }}/linux</kernel>
10 <initrd>{{ hostvars[vm_install.host].vm_host.installer.path }}/{{ vmdistro }}-{{ vmdistcodename }}/{{ vm_install.arch | default('amd64') }}/initrd.gz</initrd>
11 <cmdline>console=ttyS0,115200n8 auto=true interface=auto url=tftp://{{ hostvars[vm_install.host]['ansible_' + hostvars[vm_install.host].vm_host.installer.net_if].ipv4.address }}/vm-{{ inventory_hostname }}-{{ vmdistro }}-{{ vmdistcodename }}.cfg netcfg/choose_interface=enp1s1 netcfg/disable_autoconfig=true netcfg/get_ipaddress={{ vm_network.primary.ip }} netcfg/get_netmask={{ vm_network.primary.mask }} netcfg/get_gateway={{ vm_network.primary.gateway }} netcfg/get_nameservers="{{ vm_network.primary.nameservers | join(' ') }}" netcfg/confirm_static=true netcfg/get_hostname={{ inventory_hostname }} netcfg/get_domain={{ vm_network.primary.domain }}</cmdline>
21 <on_poweroff>destroy</on_poweroff>
22 {% if run_installer %}
23 <on_reboot>destroy</on_reboot>
24 <on_crash>destroy</on_crash>
26 <on_reboot>restart</on_reboot>
27 <on_crash>restart</on_crash>
30 <emulator>/usr/bin/kvm</emulator>
32 {% if 'virtio' in vm_install.disks %}
33 {% for device, lv in vm_install.disks.virtio.items() %}
34 <disk type='block' device='disk'>
35 <driver name='qemu' type='raw' cache='none' discard='unmap'/>
36 <source dev='/dev/mapper/{{ lv.vg | replace('-', '--') }}-{{ lv.lv | replace('-', '--') }}'/>
37 <target dev='{{ device }}' bus='virtio'/>
42 {% if 'scsi' in vm_install.disks %}
43 <controller type='scsi' index='0' model='virtio-scsi'/>
44 {% for device, lv in vm_install.disks.scsi.items() %}
45 <disk type='block' device='disk'>
46 <driver name='qemu' type='raw' cache='none' discard='unmap'/>
47 <source dev='/dev/mapper/{{ lv.vg | replace('-', '--') }}-{{ lv.lv | replace('-', '--') }}'/>
48 <target dev='{{ device }}' bus='scsi'/>
53 {% if vm_install.interfaces %}
54 {% for if in vm_install.interfaces %}
55 <interface type='bridge'>
56 <source bridge='{{ if.bridge }}'/>
57 <model type='virtio'/>
58 <address type='pci' domain='0x0000' bus='0x01' slot='0x0{{ if.idx }}' function='0x0'/>
67 <target type='serial' port='0'/>