Files
a13labs.infra/ansible/roles/gpu_monitoring/tasks/amd_exporter.yml
T
alexandre.pires 350650ecc2 Add GPU monitoring services and configurations
- Create systemd service templates for llama_exporter, nvidia_exporter, and podman.
- Add Prometheus configuration template for GPU metrics scraping.
- Introduce variables for GPU monitoring role in main.yml.
- Implement tasks for syncing llama models, including user setup and package installation.
- Update podman tasks to ensure proper sudo access and lingering for the podman user.
- Modify inventory to include gpu_monitoring group.
- Add Terraform modules for deploying Vaultwarden, including ingress and service configurations.
- Create Grafana dashboard for real-time GPU monitoring metrics.
- Update secrets and environment files to include Vaultwarden admin token.
2026-05-29 23:42:14 +02:00

83 lines
2.1 KiB
YAML

---
- name: Create amd_exporter group
become: true
ansible.builtin.group:
name: "{{ amd_exporter_user }}"
state: present
system: true
- name: Create amd_exporter user
become: true
ansible.builtin.user:
name: "{{ amd_exporter_user }}"
group: "{{ amd_exporter_user }}"
home: "{{ amd_exporter_user_home }}"
create_home: true
shell: /usr/sbin/nologin
system: true
- name: Create amd_exporter install directory
become: true
ansible.builtin.file:
path: "{{ item }}"
state: directory
owner: "{{ amd_exporter_user }}"
group: "{{ amd_exporter_user }}"
mode: "0755"
loop:
- "{{ amd_exporter_install_dir }}"
- "{{ amd_exporter_install_dir }}/logs"
- name: Copy amd_gpu_exporter script
become: true
ansible.builtin.copy:
src: amd_gpu_exporter.py
dest: "{{ amd_exporter_script_path }}"
owner: "{{ amd_exporter_user }}"
group: "{{ amd_exporter_user }}"
mode: "0755"
notify:
- Restart amd_exporter
- name: Create Python virtual environment
become: true
ansible.builtin.command:
cmd: "{{ amd_exporter_python_version }} -m venv {{ amd_exporter_venv_path }}"
creates: "{{ amd_exporter_venv_path }}/bin/activate"
- name: Install Python dependencies in venv
become: true
ansible.builtin.pip:
name:
- prometheus-client
- requests
virtualenv: "{{ amd_exporter_venv_path }}"
state: present
- name: Fix ownership of amd_exporter directory
become: true
ansible.builtin.file:
path: "{{ amd_exporter_install_dir }}"
owner: "{{ amd_exporter_user }}"
group: "{{ amd_exporter_user }}"
recurse: true
- name: Generate amd_exporter systemd service
become: true
ansible.builtin.template:
src: amdgpu_exporter.service.j2
dest: "/etc/systemd/system/{{ amd_exporter_service_name }}.service"
owner: root
group: root
mode: "0644"
notify:
- Reload systemd daemon
- Restart amd_exporter
- name: Enable amd_exporter service
become: true
ansible.builtin.systemd:
name: "{{ amd_exporter_service_name }}"
enabled: true
state: started