diff --git a/nvidia-lxc-playbook.yml b/nvidia-lxc-playbook.yml new file mode 100644 index 0000000..f3fd93c --- /dev/null +++ b/nvidia-lxc-playbook.yml @@ -0,0 +1,46 @@ +--- +- name: Install NVIDIA driver in LXC + hosts: localhost + become: true + vars: + driver_url: "http://drop.smolkik.ru/NVIDIA-Linux-x86_64-580.159.04.run" + driver_file: "NVIDIA-Linux-x86_64-580.159.04.run" + + tasks: + - name: Install dependencies + apt: + name: + - build-essential + - dkms + - linux-headers-{{ ansible_kernel }} + state: present + update_cache: true + + - name: Download driver + get_url: + url: "{{ driver_url }}" + dest: "/root/{{ driver_file }}" + mode: "0755" + + - name: Blacklist nouveau + copy: + dest: /etc/modprobe.d/blacklist-nouveau.conf + content: | + blacklist nouveau + options nouveau modeset=0 + + - name: Update initramfs + command: update-initramfs -u + changed_when: true + + - name: Install NVIDIA driver + command: /bin/bash /root/{{ driver_file }} --no-kernel-modules --silent --accept-license --dkms + register: result + + - name: Verify + command: nvidia-smi + register: smi + changed_when: false + + - debug: + msg: "{{ smi.stdout_lines }}" \ No newline at end of file