通过使用salt call-l debug在本地运行salt状态,可以获得有关salt状态失败原因的详细信息。
salt-call -l debug state.apply gpu
在您的情况下,您必须知道在Linux上安装NVIDIA驱动程序需要您在没有图形会话的情况下运行安装程序。最简单的方法是检查当前是否在图形会话中(使用systemd),然后删除do multi-user.target,如果是这样:
enter-multiuser:
cmd.run:
- name: systemctl isolate multi-user.target
- onlyif: systemctl status graphical.target
然后,您可以使用类似于
gpu-prerequisites:
pkg.installed:
- pkgs:
- kernel-devel
download-installer:
file.managed:
- name: /tmp/NVIDIA-Linux-x86_64-375.20.run
- source: salt://gpu/files/NVIDIA-Linux-x86_64-375.20.run
install-driver:
cmd.run:
- name: /tmp/NVIDIA-Linux-x86_64-375.20.run -a -s -Z -X
- require:
- file: download-installer
- pkg: gpu-prequisites
start-graphical:
cmd.run:
- name: systemctl start graphical.target
- unless: systemctl status graphical.target
- watch:
- cmd: install-driver