/
/
/
Ansible role that deployes services on my runner machine
1# LLM Stack Unified Environment Configuration
2
3# ==============================================================================
4# OLLAMA CONFIGURATION
5# ==============================================================================
6OLLAMA_HOST=0.0.0.0:11434
7OLLAMA_ORIGINS=*
8OLLAMA_MODELS=/root/.ollama/models
9OLLAMA_KEEP_ALIVE={{ llm_stack_ollama_keep_alive | default('1h') }}
10# One slot served every request, so the live agent's three questions -- is this
11# effect happening, did a mechanical event occur, what scene is this -- queued
12# behind each other at the GPU. The scene call is the slow one (thinking on,
13# measured 11.0-57.4 s live on 2026-09-03) and a sting waiting behind it lands
14# in the next conversation.
15#
16# **Three slots fit because the agent asks for a 4096 context, not 24576.**
17# Measured on 2026-09-03 with the model resident: 9.3 GB at 100% GPU with
18# 1266 MiB free, and the KV cache costs ~320 MiB per 4096-token slot. Two more
19# slots is ~640 MiB, inside the headroom.
20#
21# > `OLLAMA_CONTEXT_LENGTH` below is the SERVER ceiling, not what gets
22# > allocated: a request asking for 4096 loads 4096. Sizing the slots off the
23# > 24576 ceiling is what made this look impossible at first.
24#
25# Verify after any change -- `ollama ps` PROCESSOR must still read 100% GPU:
26# ssh [email protected] 'docker exec ollama ollama ps'
27OLLAMA_NUM_PARALLEL=3
28OLLAMA_MAX_LOADED_MODELS=1
29OLLAMA_FLASH_ATTENTION=1
30# The K/V cache quantisation. Default f16: at 16k context on the 12 GB card
31# the full-precision cache no longer fits beside qwen3:14b after the 0.32
32# upgrade, and Ollama silently splits the model 9%/91% CPU/GPU -- full
33# VRAM, half utilisation, every generation round-tripping through system
34# RAM. Measured: 10833 MiB used and 70% utilisation on a card that used to
35# hold the same model at 100% GPU. q8_0 halves the cache and restores the
36# full-GPU fit at no measurable cost to the pipeline's bounded prompts.
37OLLAMA_KV_CACHE_TYPE=q8_0
38
39# Ollama's default is 4096 and it does NOT error when a prompt exceeds it -- it
40# silently drops the front. A session over roughly 90 minutes produces a longer
41# transcript than that, so every chapter from a real evening was being written
42# from the back half only, with the beginning missing and no sign anything went
43# wrong. Nothing in the output says a word was lost, which is what made this
44# survive so long.
45#
46# 16384 rather than higher because the KV cache lives in VRAM alongside the
47# model: qwen3:14b is around 9GB of the 3060's 12GB, and a context that does not
48# fit spills to system RAM and turns a slow chapter into an unusable one. This
49# raises the ceiling; it does not remove it. The prompts still need bounding.
50OLLAMA_CONTEXT_LENGTH={{ llm_stack_ollama_context_length | default(16384) }}
51OLLAMA_GPU_OVERHEAD=0
52OLLAMA_LOG_LEVEL={{ llm_stack_ollama_log_level }}
53
54{% if gpu_enabled %}
55# GPU Configuration
56NVIDIA_VISIBLE_DEVICES=all
57NVIDIA_DRIVER_CAPABILITIES=compute,utility
58{% endif %}
59
60# ==============================================================================
61# OPENWEBUI CONFIGURATION
62# ==============================================================================
63OLLAMA_BASE_URL=http://ollama:11434
64WEBUI_NAME={{ llm_stack_openwebui_name }}
65WEBUI_DESCRIPTION={{ llm_stack_openwebui_description }}
66WEBUI_AUTHOR={{ llm_stack_openwebui_author }}
67LOG_LEVEL={{ llm_stack_openwebui_log_level }}
68PORT=8080
69
70# Database Configuration (OpenWebUI - uses default)
71
72# Features
73ENABLE_SIGNUP=true
74ENABLE_ADMIN=true
75DEFAULT_MODELS={{ llm_stack_openwebui_default_models }}
76DEFAULT_PROMPT_SUGGESTIONS=
77ENABLE_IMAGE_GENERATION=false
78ENABLE_PDF_EXPORT=true
79ENABLE_MARKDOWN=true
80ENABLE_CODE_HIGHLIGHTING=true
81
82# Web Search (Tavily)
83{% if vault_runner.tavily_api_key | default('') != '' %}
84ENABLE_WEB_SEARCH=true
85WEB_SEARCH_ENGINE=tavily
86TAVILY_API_KEY={{ vault_runner.tavily_api_key }}
87{% else %}
88ENABLE_WEB_SEARCH=false
89{% endif %}
90
91# RAG Configuration
92ENABLE_RAG=false
93RAG_API_URL=http://litellm:4000
94
95# Security
96ALLOWED_HOSTS=*
97CORS_ORIGINS=*
98
99# ==============================================================================
100# LITELLM CONFIGURATION (in separate file)
101# ==============================================================================
102