ansible_vfio_redhat

vfio-redhat

Enables the passthrough of PCI devices via IOMMU and the vfio-pci kernel module on RHEL/CentOS 7 and Fedora systems.

Requirements

Tested on CentOS 7 and Fedora 28. This should also work on equivalent RHEL.

You will need a CPU which supports IOMMU (the generic name for Intel VT-d and AMD-Vi). Your motherboard must also support IOMMU.

Role Variables

You can specify a list of vendor-ID:device-ID sets using the vfio_pci_ids variable. Find these using lspci -nn

Below are example IDs for an NVIDIA GeForce GTX 970

vfio_pci_ids: 
  - 10de:13c2
  - 10de:0fbb

The auto_reboot variable will automatically reboot your system when new devices are added if set to yes or true. The default is no/false.

auto_reboot: no

Special Considerations

After rebooting, you may want to check your IOMMU grouping like so:

#!/bin/bash
shopt -s nullglob
for d in /sys/kernel/iommu_groups/*/devices/*; do 
    n=${d#*/iommu_groups/*}; n=${n%%/*}
    printf 'IOMMU Group %s ' "$n"
    lspci -nns "${d##*/}"
done

Thanks, ArchWiki!

Make sure that the devices you marked for passthrough are in a group with no un-passed devices (excluding bridges and root ports)!

License

MIT

Author

Stephen Panicho (s.panicho@gmail.com)

With help from:

Alex Williamson's VFIO blog

The ArchWiki

About

Enables IOMMU and configures vfio-pci on RHEL/CentOS/Fedora.

Install
ansible-galaxy install stove-panini/ansible-vfio-redhat
GitHub repository
License
mit
Downloads
30
Owner
If I can write it in Bash I will write it in Bash.