Allow USB device passthrough

This commit is contained in:
Timo Makinen 2022-04-13 20:49:51 +00:00
parent 1081b98b09
commit 9f31fcfd52

View file

@ -34,13 +34,6 @@
{% endif %} {% endif %}
{% endfor %} {% endfor %}
virt_install_passthrough: >-
{% if passthrough_devices is defined %}
{% for item in passthrough_devices %}
--hostdev {{ item }}
{% endfor %}
{% endif %}
tasks: tasks:
- name: get vm list - name: get vm list
@ -86,8 +79,7 @@
command: > command: >
virt-install --name {{ inventory_hostname }} \ virt-install --name {{ inventory_hostname }} \
--graphics none --boot useserial=on --noautoconsole \ --graphics none --boot useserial=on --noautoconsole \
--serial pty,log.file={{ console_log }} \ --serial pty,log.file={{ console_log }} --sound none \
--controller usb,model=none --sound none \
--vcpus "sockets=1,cores={{ num_cpus }},threads=1,placement=auto" \ --vcpus "sockets=1,cores={{ num_cpus }},threads=1,placement=auto" \
--memory {{ mem_size }} --cpu host-passthrough \ --memory {{ mem_size }} --cpu host-passthrough \
--disk {{ os_disk_image }},{{ dsk_opts }},size={{ dsk_size }} \ --disk {{ os_disk_image }},{{ dsk_opts }},size={{ dsk_size }} \
@ -101,9 +93,10 @@
{% for dev in virt_install_devices -%} {% for dev in virt_install_devices -%}
--hostdev {{ dev }} \ --hostdev {{ dev }} \
{% endfor -%} {% endfor -%}
{% else -%}
--controller usb,model=none \
{% endif -%} {% endif -%}
{{ virt_install_disks }} \ {{ virt_install_disks }} \
{{ virt_install_passthrough }} \
{{ virt_install_network }} \ {{ virt_install_network }} \
{{ virt_install_os_args }} {{ virt_install_os_args }}
delegate_to: "{{ vmhost }}" delegate_to: "{{ vmhost }}"