This commit is contained in:
2026-03-20 13:20:58 +01:00
commit 2af73b780b
27 changed files with 333 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
---
ollama_install_dir: /opt/ollama
ollama_image: ollama/ollama
ollama_image_tag: latest
ollama_container_labels: []

View File

@@ -0,0 +1,18 @@
---
- name: Create Ollama Directories
ansible.builtin.file:
state: directory
path: "{{ ollama_install_dir }}/{{ item }}"
loop:
- data
- compose
- name: Pull Ollama Image
community.docker.docker_image:
source: pull
name: "{{ ollama_image }}:{{ ollama_image_tag }}"
- name: Copy composefile
ansible.builtin.template:
src: templates/composefile.yml
dest: "{{ ollama_install_dir }}/compose/composefile.yml"

View File

@@ -0,0 +1,5 @@
---
- name: Include selected operations for Ollama
tags:
- ollama
ansible.builtin.include_tasks: "{{ deployment_action|default('deploy') }}/main.yml"

View File

@@ -0,0 +1,20 @@
services:
ollama:
image: {{ ollama_image }}:{{ ollama_image_tag }}
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]
network_mode: host
volumes:
- {{ ollama_install_dir }}/data:/root/.ollama
tty: true
restart: unless-stopped
{% if ollama_container_labels %}
labels:
{{ ollama_container_labels|to_nice_yaml|indent(4) }}
{% endif %}