|
3 | 3 | hosts: all |
4 | 4 | become: yes |
5 | 5 | vars: |
6 | | - docker_image: "livepeer/comfystream:latest" |
| 6 | + docker_image: "livepeer/comfystream:0.0.3" |
7 | 7 | comfyui_username: "comfyadmin" |
8 | 8 | comfyui_password: "Ge}_^jn?*?5#/|FWx9I&K|S0$/)#au8" |
9 | 9 |
|
|
141 | 141 | create: yes |
142 | 142 | notify: restart caddy |
143 | 143 | # Install, configure, and start ComfyUI with Comfystream |
| 144 | + - name: Check if NVIDIA Container Toolkit is installed |
| 145 | + command: dpkg -l | grep nvidia-container-toolkit |
| 146 | + register: nvidia_toolkit_installed |
| 147 | + ignore_errors: yes |
| 148 | + changed_when: false |
| 149 | + - name: Check if NVIDIA runtime is configured in Docker |
| 150 | + command: docker info | grep -i nvidia |
| 151 | + register: nvidia_runtime_configured |
| 152 | + ignore_errors: yes |
| 153 | + changed_when: false |
144 | 154 | - name: Add NVIDIA Container Toolkit repository key |
145 | 155 | apt_key: |
146 | 156 | url: https://nvidia.github.io/libnvidia-container/gpgkey |
147 | 157 | keyring: /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg |
148 | 158 | state: present |
| 159 | + when: nvidia_toolkit_installed.rc != 0 |
149 | 160 | - name: Add NVIDIA Container Toolkit repository |
150 | 161 | get_url: |
151 | 162 | url: https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list |
152 | 163 | dest: /etc/apt/sources.list.d/nvidia-container-toolkit.list |
153 | 164 | mode: "0644" |
| 165 | + when: nvidia_toolkit_installed.rc != 0 |
154 | 166 | - name: Ensure NVIDIA repository uses correct signing key |
155 | 167 | replace: |
156 | 168 | path: /etc/apt/sources.list.d/nvidia-container-toolkit.list |
157 | 169 | regexp: "^deb https://" |
158 | 170 | replace: "deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://" |
| 171 | + when: nvidia_toolkit_installed.rc != 0 |
159 | 172 | - name: Install NVIDIA Container Toolkit |
160 | 173 | apt: |
161 | 174 | name: nvidia-container-toolkit |
|
165 | 178 | delay: 30 |
166 | 179 | register: nvidia_toolkit_result |
167 | 180 | until: nvidia_toolkit_result is success |
| 181 | + when: nvidia_toolkit_installed.rc != 0 |
168 | 182 | - name: Configure Docker to use NVIDIA runtime |
169 | 183 | command: nvidia-ctk runtime configure --runtime=docker |
170 | 184 | register: nvidia_ctk_result |
171 | 185 | changed_when: nvidia_ctk_result.rc == 0 |
| 186 | + when: nvidia_runtime_configured.rc != 0 |
172 | 187 | - name: Restart Docker service |
173 | 188 | systemd: |
174 | 189 | name: docker |
175 | 190 | state: restarted |
176 | 191 | enabled: yes |
| 192 | + when: nvidia_runtime_configured.rc != 0 |
177 | 193 | # Install, configure, and start ComfyUI with Comfystream |
178 | 194 | - name: Install community.docker collection |
179 | 195 | command: ansible-galaxy collection install community.docker |
|
0 commit comments