mirror of
https://gitea.fenix-dev.com/fenix-gitea-admin/iac-ansible-private.git
synced 2025-12-16 19:27:37 +00:00
75 lines
2.2 KiB
YAML
75 lines
2.2 KiB
YAML
- name: Instalar driver NVIDIA
|
|
become: yes
|
|
ansible.builtin.apt:
|
|
name: nvidia-driver-550
|
|
state: present
|
|
|
|
- name: Instalar utilitários NVIDIA
|
|
become: yes
|
|
ansible.builtin.apt:
|
|
name: nvidia-utils-550
|
|
state: present
|
|
|
|
|
|
- name: Reboot host e esperar voltar
|
|
become: yes
|
|
ansible.builtin.reboot:
|
|
reboot_timeout: 600 # tempo máximo para o host voltar (segundos)
|
|
test_command: whoami # comando usado para validar que o host voltou
|
|
|
|
- name: Adicionar chave GPG da NVIDIA
|
|
become: yes
|
|
become_user: fenix
|
|
ansible.builtin.shell: |
|
|
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit.gpg
|
|
args:
|
|
creates: /usr/share/keyrings/nvidia-container-toolkit.gpg
|
|
|
|
- name: Adicionar repositório NVIDIA
|
|
become: yes
|
|
ansible.builtin.shell: |
|
|
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
|
|
&& curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
|
|
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
|
|
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
|
|
args:
|
|
creates: /etc/apt/sources.list.d/nvidia-container-toolkit.list
|
|
|
|
- name: Atualizar cache de pacotes
|
|
become: yes
|
|
ansible.builtin.apt:
|
|
update_cache: yes
|
|
|
|
- name: Instalar NVIDIA Container Toolkit
|
|
become: yes
|
|
ansible.builtin.apt:
|
|
name: nvidia-container-toolkit
|
|
state: present
|
|
|
|
|
|
- name: Configurar runtime containerd
|
|
become: yes
|
|
ansible.builtin.shell: |
|
|
nvidia-ctk runtime configure --runtime=containerd
|
|
|
|
- name: Reiniciar containerd
|
|
become: yes
|
|
ansible.builtin.systemd:
|
|
name: containerd
|
|
state: restarted
|
|
|
|
|
|
- name: Mostrar resultado nvidia-smi
|
|
become: yes
|
|
ansible.builtin.debug:
|
|
var: nvidia_smi_output.stdout
|
|
|
|
|
|
|
|
- name: Aplicar o stolon
|
|
become: yes
|
|
become_user: fenix
|
|
shell: |
|
|
kubectl apply -f https://raw.githubusercontent.com/NVIDIA/k8s-device-plugin/v0.17.1/deployments/static/nvidia-device-plugin.yml
|
|
environment:
|
|
KUBECONFIG: /home/fenix/.kube/config |