Добавить nvidia-lxc-playbook.yml
This commit is contained in:
46
nvidia-lxc-playbook.yml
Normal file
46
nvidia-lxc-playbook.yml
Normal file
@@ -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 }}"
|
||||
Reference in New Issue
Block a user