46 lines
1.1 KiB
YAML
46 lines
1.1 KiB
YAML
---
|
|
- 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 }}" |