homelab/roles/ollama/tasks/main.yml
2024-11-17 23:18:27 +05:00

54 lines
1.8 KiB
YAML

---
- name: Create ollama docker volumes
become: true
community.docker.docker_volume:
name: "{{ item }}"
loop:
- ollama
- open-webui
- name: Create ollama network
become: true
community.docker.docker_network:
name: ollama
- name: Run ollama
become: true
community.docker.docker_container:
name: ollama-1
image: ollama/ollama:0.4.2
volumes:
- ollama:/root/.ollama
networks:
- name: ollama
restart_policy: unless-stopped
- name: Run ollama web ui
become: true
community.docker.docker_container:
name: open-webui-1
image: ghcr.io/open-webui/open-webui:git-96c8654
env:
OLLAMA_BASE_URL: http://ollama-1:11434
DATABASE_URL: "{{ database_url }}"
DATABASE_POOL_SIZE: "{{ database_pool_size | string }}"
WEBUI_SECRET_KEY: "{{ webui_secret_key }}"
WEBUI_URL: "{{ webui_url }}"
ENABLE_LOGIN_FORM: "{{ enable_login_form | string }}"
ADMIN_EMAIL: "{{ admin_email }}"
TASK_MODEL: "{{ task_model }}"
ENABLE_RAG_WEB_SEARCH: "{{ enable_rag_web_search | string }}"
ENABLE_SEARCH_QUERY: "{{ enable_search_query | string }}"
ENABLE_OAUTH_SIGNUP: "{{ enable_oauth_signup | string }}"
OAUTH_MERGE_ACCOUNTS_BY_EMAIL: "{{ oauth_merge_accounts_by_email | string }}"
OAUTH_USERNAME_CLAIM: "{{ oauth_username_claim }}"
OAUTH_CLIENT_ID: "{{ oauth_client_id }}"
OAUTH_CLIENT_SECRET: "{{ oauth_client_secret }}"
OAUTH_SCOPES: "{{ oauth_scopes }}"
OAUTH_PROVIDER_NAME: "{{ oauth_provider_name }}"
OPENID_PROVIDER_URL: "{{ openid_provider_url }}"
OPENID_REDIRECT_URI: "{{ openid_redirect_uri }}"
volumes:
- open-webui:/app/backend/data
networks:
- name: ollama
- name: haproxy
- name: postgresql
restart_policy: unless-stopped