feat: Add Open WebUI role to the first host

This commit is contained in:
Tobias J. Endres 2025-09-01 18:13:20 +02:00
parent 8411365d0c
commit c4c8e86486
6 changed files with 81 additions and 1 deletions

View File

@ -3,4 +3,5 @@
become: true
roles:
- docker
- portainer
- portainer
- openwebui

View File

@ -0,0 +1,34 @@
# Ansible Role: Open WebUI Docker Compose
An Ansible role to deploy Open WebUI using Docker Compose.
## Requirements
- Docker
- Docker Compose
## Role Variables
Available variables are listed below, along with default values (see `defaults/main.yml`):
```yaml
openwebui_data_dir: "/opt/open-webui"
openwebui_port: 8080
openwebui_ollama_base_url: "http://localhost:11434"
```
## Dependencies
- docker
## Example Playbook
```yaml
- hosts: "servers"
roles:
- role: "openwebui"
```
## License
MIT

View File

@ -0,0 +1,4 @@
---
openwebui_data_dir: "/opt/open-webui"
openwebui_port: 8080
openwebui_ollama_base_url: "http://localhost:11434"

View File

@ -0,0 +1,12 @@
galaxy_info:
author: "Your Name"
description: "An Ansible role to deploy Open WebUI using Docker Compose"
license: "MIT"
min_ansible_version: "2.9"
platforms:
- name: "Ubuntu"
versions:
- "focal"
- "bionic"
dependencies:
- role: docker

View File

@ -0,0 +1,16 @@
---
- name: "Create Open WebUI directory"
ansible.builtin.file:
path: "{{ openwebui_data_dir }}"
state: "directory"
mode: "0755"
- name: "Create Open WebUI docker-compose.yml"
ansible.builtin.template:
src: "docker-compose.yml.j2"
dest: "{{ openwebui_data_dir }}/docker-compose.yml"
- name: "Start Open WebUI services"
community.docker.docker_compose:
project_src: "{{ openwebui_data_dir }}"
state: "present"

View File

@ -0,0 +1,13 @@
version: '3.8'
services:
open-webui:
image: ghcr.io/open-webui/open-webui:main
container_name: open-webui
ports:
- "{{ openwebui_port }}:8080"
volumes:
- "{{ openwebui_data_dir }}:/app/backend/data"
environment:
- OLLAMA_BASE_URL={{ openwebui_ollama_base_url }}
restart: always