M6: open_webui-Rolle OIDC-vorbereitet (Keycloak gnai-openwebui, WEBUI_URL chat.*, Client-Secret als Podman-Secret)
ci-static / secret-scan (pull_request) Successful in 20s
ci-static / yamllint (pull_request) Successful in 29s
ci-static / ansible-syntax (pull_request) Successful in 27s
ci-static / markdown-links (pull_request) Successful in 20s
ci-static / secret-scan (push) Successful in 20s
ci-static / yamllint (push) Successful in 30s
ci-static / ansible-syntax (push) Successful in 27s
ci-static / markdown-links (push) Successful in 22s

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
2026-11-11 06:46:01 +01:00
co-authored by Mistral Vibe
parent 0926dea0b7
commit 6cd9d49b62
3 changed files with 53 additions and 0 deletions
@@ -34,6 +34,19 @@ open_webui_container_port: 8080
# Persistent app data (SQLite DB, uploads, cache).
open_webui_data_dir: /var/lib/ghostnet-ai/production/openwebui-data
# OIDC phase (M6 public route via NPM + Keycloak). Disabled for the
# internal phase; enable together with the Keycloak client
# `gnai-openwebui` and the NPM proxy host chat.ghostnet.selfhost.eu.
# The client secret is created as a Podman secret by the operator (the
# Keycloak-generated value never enters git):
# runuser -u gnai-production -- podman secret create \
# openwebui-oidc-client-secret -
open_webui_oidc_enabled: false
open_webui_oidc_client_id: gnai-openwebui
open_webui_oidc_client_secret_secret: openwebui-oidc-client-secret
open_webui_oidc_provider_url: https://auth.ghostnet.selfhost.eu/realms/Ghost.net/.well-known/openid-configuration
open_webui_public_url: https://chat.ghostnet.selfhost.eu
# Internal phase: local auth with first-user-is-admin. The public OIDC
# phase (M6 route) switches ENABLE_OAUTH_* on and disables local signup.
open_webui_env:
@@ -122,6 +122,36 @@
when: open_webui_engine_secret_exists.rc == 1
no_log: true
- name: Check whether the OIDC client secret exists (required when OIDC is enabled)
ansible.builtin.command:
argv:
- /usr/sbin/runuser
- --user
- "{{ open_webui_user }}"
- --
- /usr/bin/env
- "HOME={{ open_webui_home }}"
- "XDG_RUNTIME_DIR=/run/user/{{ open_webui_uid }}"
- /usr/bin/podman
- secret
- exists
- "{{ open_webui_oidc_client_secret_secret }}"
chdir: "{{ open_webui_home }}"
changed_when: false
failed_when: false
check_mode: false
register: open_webui_oidc_secret_exists
- name: Require the OIDC client secret when OIDC is enabled
ansible.builtin.fail:
msg: >-
open_webui_oidc_enabled=true requires the Podman secret
{{ open_webui_oidc_client_secret_secret }} (operator creates it from
the Keycloak client secret, never in git).
when:
- open_webui_oidc_enabled | bool
- open_webui_oidc_secret_exists.rc != 0
- name: Render the OpenWebUI quadlet
ansible.builtin.template:
src: open-webui.container.j2
@@ -16,6 +16,16 @@ Secret={{ open_webui_engine_api_key_secret }},type=env,target=OPENAI_API_KEY
{% for key, value in open_webui_env.items() %}
Environment={{ key }}={{ value }}
{% endfor %}
{% if open_webui_oidc_enabled %}
Environment=WEBUI_URL={{ open_webui_public_url }}
Environment=ENABLE_OAUTH_SIGNUP=True
Environment=ENABLE_SIGNUP=False
Environment=OPENID_PROVIDER_URL={{ open_webui_oidc_provider_url }}
Environment=OAUTH_CLIENT_ID={{ open_webui_oidc_client_id }}
Environment=OAUTH_SCOPES=openid email profile
Environment=OAUTH_PROVIDER_NAME=Keycloak
Secret={{ open_webui_oidc_client_secret_secret }},type=env,target=OAUTH_CLIENT_SECRET
{% endif %}
[Service]
Restart=on-failure