--- # tasks file for roles/ollama # Modellverwaltung: Es werden nur Modelle heruntergeladen, die noch nicht vorhanden sind. - name: ollama | models | list installed models tags: ollama,models ansible.builtin.command: ollama list register: ollama_installed_models changed_when: false # Kurzes Warten auf den frisch gestarteten Daemon beim Erstlauf (Retry-Muster wie omada-controller). retries: 5 until: ollama_installed_models is success delay: 2 - name: ollama | models | pull missing models tags: ollama,models ansible.builtin.command: ollama pull {{ item }} loop: "{{ ollama_models }}" # 'ollama list' führt die Modellnamen in der ersten Spalte auf; ein bereits # vorhandenes Modell wird nicht erneut heruntergeladen. when: item not in ollama_installed_models.stdout