- name: Install nvidia-cdi-generator
  become: true
  ansible.builtin.package:
    name:
      - nvidia-container-toolkit
    state: present

- name: Create systemd service file for nvidia-cdi-generator
  become: true
  ansible.builtin.copy:
    src: services/nvidia-cdi-generator.service
    dest: /etc/systemd/system/nvidia-cdi-generator.service
    owner: root
    group: root
    mode: "0644"

- name: Reload systemd daemon
  become: true
  ansible.builtin.systemd:
    daemon_reload: true
    name: nvidia-cdi-generator

- name: Enable nvidia-cdi-generator service
  become: true
  ansible.builtin.systemd:
    name: nvidia-cdi-generator
    enabled: true
    state: started
