diff --git a/hosts b/hosts index aa01d67..49958bb 100644 --- a/hosts +++ b/hosts @@ -33,8 +33,8 @@ all: ansible_host: 192.168.10.10 server-0: ansible_host: 192.168.10.11 - # vars: - # ansible_user: root + vfio_pci_ids: + - '1000:0086' # Broadcom / LSI SAS2308 PCI-Express Fusion-MPT SAS-2 lb: hosts: lb: diff --git a/roles/proxmox/handlers/main.yml b/roles/proxmox/handlers/main.yml index de728f0..77209c3 100644 --- a/roles/proxmox/handlers/main.yml +++ b/roles/proxmox/handlers/main.yml @@ -1,2 +1,5 @@ - name: update grub command: update-grub + +- name: update initramfs + command: update-initramfs -u -k all \ No newline at end of file diff --git a/roles/proxmox/tasks/main.yml b/roles/proxmox/tasks/main.yml index a6d8c98..9b74808 100644 --- a/roles/proxmox/tasks/main.yml +++ b/roles/proxmox/tasks/main.yml @@ -2,9 +2,26 @@ lineinfile: path: /etc/default/grub regexp: '^GRUB_CMDLINE_LINUX_DEFAULT=' - line: 'GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on"' + line: GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on" notify: update grub +- name: Enable vfio kernel modules + blockinfile: + path: /etc/modules + block: | + vfio + vfio_iommu_type1 + vfio_pci + vfio_virqfd + notify: update initramfs + +- name: Configure vfio-pci + template: + src: vfio.conf + dest: /etc/modprobe.d/vfio.conf + when: vfio_pci_ids is defined + notify: update initramfs + - name: Enable PAM users lineinfile: path: /etc/pve/user.cfg @@ -14,9 +31,16 @@ - name: Enable PAM users admin access lineinfile: path: /etc/pve/user.cfg - line: 'acl:1:/:{{ item.key }}@pam:PVEAdmin:' + line: 'acl:1:/:{{ item.key }}@pam:Administrator:' with_dict: '{{ users }}' +# - name: Force quorum to always be reached +# lineinfile: +# path: /etc/pve/corosync.conf +# regexp: 'quorum_votes' +# line: ' quorum_votes: 2' +# with_dict: '{{ users }}' + - name: Copy pve-no-subscription.list copy: src: pve-no-subscription.list diff --git a/roles/proxmox/templates/vfio.conf b/roles/proxmox/templates/vfio.conf new file mode 100644 index 0000000..d03ddd8 --- /dev/null +++ b/roles/proxmox/templates/vfio.conf @@ -0,0 +1,3 @@ +options vfio-pci ids={{ ','.join(vfio_pci_ids) }} +# options vfio_iommu_type1 allow_unsafe_interrupts=1 +blacklist mpt3sas \ No newline at end of file