diff options
-rw-r--r-- | dan/ele-winvm.yml | 6 | ||||
-rw-r--r-- | inventory/host_vars/ele-winvm.yml | 16 | ||||
-rw-r--r-- | inventory/hosts.ini | 1 | ||||
-rw-r--r-- | roles/vm/guest/create/templates/libvirt-domain.xml.j2 | 38 |
4 files changed, 58 insertions, 3 deletions
diff --git a/dan/ele-winvm.yml b/dan/ele-winvm.yml new file mode 100644 index 00000000..4d6d1c54 --- /dev/null +++ b/dan/ele-winvm.yml @@ -0,0 +1,6 @@ +--- +- name: Basic Setup + hosts: ele-winvm + gather_facts: no + roles: + - role: vm/guest/create diff --git a/inventory/host_vars/ele-winvm.yml b/inventory/host_vars/ele-winvm.yml index 16c3d125..ad9e9bec 100644 --- a/inventory/host_vars/ele-winvm.yml +++ b/inventory/host_vars/ele-winvm.yml @@ -4,6 +4,22 @@ install: memory: 16G numcpus: 8 autostart: True + # boot: + # - cdrom + # - hd + pci_passthrough: + - domain: 0 + bus: 4 + slot: 0 + function: 0 + graphics: + proto: spice + port: 5900 + address: 0.0.0.0 + model: virtio + # cdrom: + # sdy: /srv/installer/win10.iso + # sdz: /srv/installer/virtio-win-0.1.221.iso disks: primary: /dev/sda scsi: diff --git a/inventory/hosts.ini b/inventory/hosts.ini index 1865d25b..b43eb755 100644 --- a/inventory/hosts.ini +++ b/inventory/hosts.ini @@ -240,6 +240,7 @@ ele-gwhetzner ele-mur ele-coturn ele-jitsi +ele-winvm [elevate:children] ele-ap diff --git a/roles/vm/guest/create/templates/libvirt-domain.xml.j2 b/roles/vm/guest/create/templates/libvirt-domain.xml.j2 index a7d584dc..c4ab6a4a 100644 --- a/roles/vm/guest/create/templates/libvirt-domain.xml.j2 +++ b/roles/vm/guest/create/templates/libvirt-domain.xml.j2 @@ -21,7 +21,9 @@ <boot dev='cdrom'/> {% endif %} {% else %} - <boot dev='hd'/> +{% for device in install.vm.boot | default(['hd']) %} + <boot dev='{{ device }}'/> +{% endfor %} {% endif %} </os> <features> @@ -56,7 +58,18 @@ </disk> {% endif %} -{% if install.disks %} +{% if 'cdrom' in install.vm %} +{% for device,image in install.vm.cdrom.items() %} + <disk type='file' device='cdrom'> + <driver name='qemu'/> + <source file='{{ image }}'/> + <target dev='{{ device }}' bus='sata'/> + <readonly/> + </disk> +{% endfor %} + +{% endif %} +{% if 'disks' in install %} {% if 'scsi' in install.disks %} <controller type='scsi' index='0' model='virtio-scsi'/> {% endif %} @@ -89,7 +102,7 @@ {% endfor %} {% endif %} -{% if install.interfaces %} +{% if 'interfaces' in install %} {% for if in install.interfaces %} <interface type='bridge'> {% if 'mac' in if %} @@ -102,6 +115,25 @@ {% endfor %} {% endif %} +{% if 'pci_passthrough' in install.vm %} +{% for device in install.vm.pci_passthrough %} + <hostdev mode='subsystem' type='pci' managed='yes'> + <source> + <address domain='{{ "0x%04x" | format(device.domain) }}' bus='{{ "0x%02x" | format(device.bus) }}' slot='{{ "0x%02x" | format(device.slot) }}' function='{{ "0x%01x" | format(device.slot) }}'/> + </source> + </hostdev> +{% endfor %} + +{% endif %} +{% if 'graphics' in install.vm %} + <graphics type='{{ install.vm.graphics.proto }}' port='{{ install.vm.graphics.port }}'> + <listen type='address' address='{{ install.vm.graphics.address }}' /> + </graphics> + <video> + <model type='{{ install.vm.graphics.model }}' /> + </video> + +{% endif %} <serial type='pty'> <target port='0'/> </serial> |