- name: Check if NVIDIA Container Toolkit is already installed shell: nvidia-ctk --version register: toolkit_check ignore_errors: true failed_when: false - name: Set Container Toolkit installation flag set_fact: container_toolkit_installed: "{{ toolkit_check.rc == 0 }}" - name: Install NVIDIA Container Toolkit include_tasks: "install-container-toolkit-{{ ansible_os_family }}.yml" when: not container_toolkit_installed | default(false) - debug: msg="NVIDIA Container Toolkit installed successfully" when: not container_toolkit_installed | default(false)