41 lines
1.1 KiB
YAML

---
# Part of role: ollama
# Called by: ansible/playbooks/setup-ollama.yaml
# Description: Installs Ollama via Homebrew, deploys the launchd plist so it starts on boot bound to all interfaces, and pulls configured models.
- name: Install ollama via Homebrew
community.general.homebrew:
name: ollama
state: present
- name: Deploy ollama launchd plist
template:
src: ollama.plist.j2
dest: /Library/LaunchDaemons/com.ollama.ollama.plist
owner: root
group: wheel
mode: "0644"
become: true
notify: restart ollama
- name: Load ollama launchd service
become: true
command: launchctl load -w /Library/LaunchDaemons/com.ollama.ollama.plist
args:
creates: /var/run/ollama.pid
ignore_errors: true
- name: Wait for ollama to be ready
uri:
url: "http://localhost:{{ ollama_port }}"
status_code: 200
register: result
until: result.status == 200
retries: 10
delay: 3
- name: Pull ollama models
command: /opt/homebrew/bin/ollama pull {{ item }}
loop: "{{ ollama_models }}"
environment:
OLLAMA_HOST: "http://localhost:{{ ollama_port }}"