summaryrefslogtreecommitdiff
path: root/roles/vm/define/templates
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2020-07-07 22:09:19 +0200
committerChristian Pointner <equinox@spreadspace.org>2020-07-11 02:29:02 +0200
commit6eacc2ad5539abf37dc90cd378b44320f7758869 (patch)
treeeacbf207b610a8ee93f830b381d91491671f6ae5 /roles/vm/define/templates
parentch-oulu: interface config (diff)
refactor vm role names
Diffstat (limited to 'roles/vm/define/templates')
-rw-r--r--roles/vm/define/templates/libvirt-domain.xml.j2102
1 files changed, 0 insertions, 102 deletions
diff --git a/roles/vm/define/templates/libvirt-domain.xml.j2 b/roles/vm/define/templates/libvirt-domain.xml.j2
deleted file mode 100644
index ba0dcd5a..00000000
--- a/roles/vm/define/templates/libvirt-domain.xml.j2
+++ /dev/null
@@ -1,102 +0,0 @@
-<domain type='kvm'>
- <name>{{ install_hostname }}</name>
- <memory>{{ ((hostvars[install_hostname].install_cooked.vm.memory | human_to_bytes) / 1024) | int }}</memory>
- <currentMemory>{{ ((hostvars[install_hostname].install_cooked.vm.memory | human_to_bytes) / 1024) | int }}</currentMemory>
- <vcpu>{{ hostvars[install_hostname].install_cooked.vm.numcpus }}</vcpu>
- <os>
- <type arch='x86_64' machine='pc-0.12'>hvm</type>
-{% if vm_define_installer %}
-{% if install_distro == 'debian' or install_distro == 'ubuntu' %}
- <kernel>{{ installer_base_path }}/{{ install_distro }}-{{ install_codename }}/{{ hostvars[install_hostname].install_cooked.arch | default('amd64') }}-netboot/linux</kernel>
- <initrd>{{ installer_tmpdir }}/initrd.{{ install_hostname }}.gz</initrd>
- <cmdline>console=ttyS0,115200n8 DEBCONF_DEBUG=5</cmdline>
- <boot dev='hd'/>
-{% elif install_distro == 'openbsd' %}
- <boot dev='cdrom'/>
-{% endif %}
-{% else %}
- <boot dev='hd'/>
-{% endif %}
- </os>
- <features>
- <acpi/>
- <apic/>
- <pae/>
- </features>
- <clock offset='utc'/>
- <on_poweroff>destroy</on_poweroff>
-{% if vm_define_installer %}
- <on_reboot>destroy</on_reboot>
- <on_crash>destroy</on_crash>
-{% else %}
- <on_reboot>restart</on_reboot>
- <on_crash>restart</on_crash>
-{% endif %}
- <devices>
- <emulator>/usr/bin/kvm</emulator>
- <!-- Provide a virtualized RNG to the guest -->
- <rng model='virtio'>
- <!-- Allow consuming up to 10kb/s, measured over 2s -->
- <rate period="2000" bytes="20480"/>
- <backend model='random'>/dev/random</backend>
- </rng>
-
-{% if vm_define_installer and install_distro == 'openbsd' %}
- <disk type='file' device='cdrom'>
- <driver name='qemu'/>
- <source file='{{ installer_tmpdir }}/{{ install_hostname }}.iso'/>
- <target dev='hdc' bus='ide'/>
- <readonly/>
- </disk>
-
-{% endif %}
-{% if 'virtio' in hostvars[install_hostname].install_cooked.disks %}
-{% for device, src in hostvars[install_hostname].install_cooked.disks.virtio.items() %}
- <disk type='block' device='disk'>
- <driver name='qemu' type='raw' cache='none' discard='unmap'/>
-{% if src.type == 'lvm' %}
- <source dev='/dev/mapper/{{ src.vg | replace('-', '--') }}-{{ src.lv | replace('-', '--') }}'/>
-{% elif src.type == 'zfs' %}
- <source dev='/dev/zvol/{{ vm_host_cooked.zfs[src.backend | default('default')].pool }}/{{ vm_host_cooked.zfs[src.backend | default('default')].name }}/{{ install_hostname }}/{{ src.name }}'/>
-{% endif %}
- <target dev='{{ device }}' bus='virtio'/>
- </disk>
-{% endfor %}
-{% endif %}
-
-{% if 'scsi' in hostvars[install_hostname].install_cooked.disks %}
- <controller type='scsi' index='0' model='virtio-scsi'/>
-{% for device, src in hostvars[install_hostname].install_cooked.disks.scsi.items() %}
- <disk type='block' device='disk'>
- <driver name='qemu' type='raw' cache='none' discard='unmap'/>
-{% if src.type == 'lvm' %}
- <source dev='/dev/mapper/{{ src.vg | replace('-', '--') }}-{{ src.lv | replace('-', '--') }}'/>
-{% elif src.type == 'zfs' %}
- <source dev='/dev/zvol/{{ vm_host_cooked.zfs[src.backend | default('default')].pool }}/{{ vm_host_cooked.zfs[src.backend | default('default')].name }}/{{ install_hostname }}/{{ src.name }}'/>
-{% endif %}
- <target dev='{{ device }}' bus='scsi'/>
- </disk>
-{% endfor %}
-{% endif %}
-
-{% if hostvars[install_hostname].install_cooked.interfaces %}
-{% for if in hostvars[install_hostname].install_cooked.interfaces %}
- <interface type='bridge'>
-{% if 'mac' in if %}
- <mac address='{{ if.mac }}'/>
-{% endif %}
- <source bridge='{{ if.bridge }}'/>
- <model type='virtio'/>
- <address type='pci' domain='0x0000' bus='0x01' slot='0x0{{ loop.index }}' function='0x0'/>
- </interface>
-{% endfor %}
-{% endif %}
-
- <serial type='pty'>
- <target port='0'/>
- </serial>
- <console type='pty'>
- <target type='serial' port='0'/>
- </console>
- </devices>
-</domain>