-
Notifications
You must be signed in to change notification settings - Fork 0
/
pci-pass.yml
47 lines (42 loc) · 1.06 KB
/
pci-pass.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
---
- hosts: pci-pass
become: true
tasks:
- name: enable vfio module in boot
blockinfile:
dest: /etc/modules-load.d/modules.conf
block: |
vfio
vfio_iommu_type1
vfio_pci
vfio_virqfd
- name: Create blacklist config
ansible.builtin.file:
path: /etc/modprobe.d/blacklist.conf
state: touch
mode: '0644'
owner: root
group: root
- name: blacklist nvidia module in boot
blockinfile:
dest: /etc/modprobe.d/blacklist.conf
block: |
blacklist nouveau
- name: Check if IOMMU is enabled
lineinfile:
backup: true
path: /etc/default/grub
regexp: '^GRUB_CMDLINE_LINUX=".*amd_iommu=on iommu=pt.*'
state: absent
check_mode: true
register: grub_cmdline_check
changed_when: false
- name: Enable IOMMU
lineinfile:
backrefs: true
path: /etc/default/grub
regexp: "^(GRUB_CMDLINE_LINUX=\".*)\"$"
line: '\1 amd_iommu=on iommu=pt"'
when: grub_cmdline_check.found == 0
- name: update-grub
shell: update-grub2