2026-01-06 09:30:54 +01:00
|
|
|
---
|
2026-01-08 16:56:19 +01:00
|
|
|
# OIDC/SSO integration tasks for Nextcloud with Authentik
|
2026-01-06 09:30:54 +01:00
|
|
|
|
|
|
|
|
- name: Check if user_oidc app is installed
|
|
|
|
|
shell: docker exec -u www-data nextcloud php occ app:list --output=json
|
|
|
|
|
register: nextcloud_apps
|
|
|
|
|
changed_when: false
|
|
|
|
|
|
|
|
|
|
- name: Parse installed apps
|
|
|
|
|
set_fact:
|
|
|
|
|
user_oidc_installed: "{{ 'user_oidc' in (nextcloud_apps.stdout | from_json).enabled }}"
|
|
|
|
|
|
|
|
|
|
- name: Install user_oidc app
|
|
|
|
|
shell: docker exec -u www-data nextcloud php occ app:install user_oidc
|
|
|
|
|
when: not user_oidc_installed
|
|
|
|
|
register: oidc_install
|
|
|
|
|
changed_when: "'installed' in oidc_install.stdout"
|
|
|
|
|
|
|
|
|
|
- name: Enable user_oidc app
|
|
|
|
|
shell: docker exec -u www-data nextcloud php occ app:enable user_oidc
|
|
|
|
|
when: not user_oidc_installed
|
|
|
|
|
|
2026-01-08 16:56:19 +01:00
|
|
|
- name: Check if Authentik OIDC credentials are available
|
|
|
|
|
stat:
|
|
|
|
|
path: /tmp/authentik_oidc_credentials.json
|
|
|
|
|
register: oidc_creds_file
|
|
|
|
|
|
|
|
|
|
- name: Load OIDC credentials from Authentik
|
|
|
|
|
slurp:
|
|
|
|
|
path: /tmp/authentik_oidc_credentials.json
|
|
|
|
|
register: oidc_creds_content
|
|
|
|
|
when: oidc_creds_file.stat.exists
|
|
|
|
|
|
|
|
|
|
- name: Parse OIDC credentials
|
|
|
|
|
set_fact:
|
|
|
|
|
authentik_oidc: "{{ oidc_creds_content.content | b64decode | from_json }}"
|
|
|
|
|
when: oidc_creds_file.stat.exists
|
|
|
|
|
|
2026-01-06 09:49:16 +01:00
|
|
|
- name: Check if OIDC provider is already configured
|
|
|
|
|
shell: docker exec -u www-data nextcloud php occ user_oidc:provider
|
|
|
|
|
register: oidc_providers
|
|
|
|
|
changed_when: false
|
|
|
|
|
failed_when: false
|
|
|
|
|
|
2026-01-08 16:56:19 +01:00
|
|
|
- name: Configure Authentik OIDC provider
|
2026-01-06 09:49:16 +01:00
|
|
|
shell: |
|
2026-01-08 16:56:19 +01:00
|
|
|
docker exec -u www-data nextcloud php occ user_oidc:provider \
|
|
|
|
|
--clientid="{{ authentik_oidc.client_id }}" \
|
|
|
|
|
--clientsecret="{{ authentik_oidc.client_secret }}" \
|
|
|
|
|
--discoveryuri="{{ authentik_oidc.discovery_uri }}" \
|
|
|
|
|
"Authentik"
|
2026-01-06 09:49:16 +01:00
|
|
|
when:
|
2026-01-08 16:56:19 +01:00
|
|
|
- authentik_oidc is defined
|
|
|
|
|
- authentik_oidc.success | default(false)
|
|
|
|
|
- "'Authentik' not in oidc_providers.stdout"
|
2026-01-06 09:49:16 +01:00
|
|
|
register: oidc_config
|
2026-01-08 16:56:19 +01:00
|
|
|
changed_when: oidc_config.rc == 0
|
|
|
|
|
|
chore: Post-workshop state - January 23rd, 2026
This commit captures the infrastructure state immediately following
the "Post-Tyranny Tech" workshop on January 23rd, 2026.
Infrastructure Status:
- 13 client servers deployed (white, valk, zwaan, specht, das, uil, vos,
haas, wolf, ree, mees, mus, mol, kikker)
- Services: Authentik SSO, Nextcloud, Collabora Office, Traefik
- Private network architecture with edge NAT gateway
- OIDC integration between Authentik and Nextcloud
- Automated recovery flows and invitation system
- Container update monitoring with Diun
- Uptime monitoring with Uptime Kuma
Changes include:
- Multiple new client host configurations
- Network architecture improvements (private IPs + NAT)
- DNS management automation
- Container update notifications
- Email configuration via Mailgun
- SSH key generation for all clients
- Encrypted secrets for all deployments
- Health check and diagnostic scripts
Known Issues to Address:
- Nextcloud version pinned to v30 (should use 'latest' or v32)
- Zitadel references in templates (migrated to Authentik but templates not updated)
- Traefik dynamic config has obsolete static routes
🤖 Generated with Claude Code (https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-23 20:36:31 +01:00
|
|
|
- name: Configure OIDC settings (allow native login + OIDC)
|
|
|
|
|
shell: |
|
|
|
|
|
docker exec -u www-data nextcloud php occ config:app:set user_oidc allow_multiple_user_backends --value=1
|
|
|
|
|
docker exec -u www-data nextcloud php occ config:app:set user_oidc auto_provision --value=1
|
|
|
|
|
docker exec -u www-data nextcloud php occ config:app:set user_oidc single_logout --value=0
|
|
|
|
|
when:
|
|
|
|
|
- authentik_oidc is defined
|
|
|
|
|
- authentik_oidc.success | default(false)
|
|
|
|
|
register: oidc_settings
|
|
|
|
|
changed_when: oidc_settings.rc == 0
|
|
|
|
|
|
2026-01-08 16:56:19 +01:00
|
|
|
- name: Cleanup OIDC credentials file
|
|
|
|
|
file:
|
|
|
|
|
path: /tmp/authentik_oidc_credentials.json
|
|
|
|
|
state: absent
|
|
|
|
|
when: oidc_creds_file.stat.exists
|
2026-01-06 09:49:16 +01:00
|
|
|
|
|
|
|
|
- name: Display OIDC status
|
2026-01-06 09:30:54 +01:00
|
|
|
debug:
|
|
|
|
|
msg: |
|
2026-01-08 16:56:19 +01:00
|
|
|
{% if authentik_oidc is defined and authentik_oidc.success | default(false) %}
|
|
|
|
|
✓ OIDC SSO fully configured!
|
|
|
|
|
Users can login with Authentik credentials at: https://{{ nextcloud_domain }}
|
|
|
|
|
|
|
|
|
|
"Login with Authentik" button should be visible on the login page.
|
2026-01-06 09:49:16 +01:00
|
|
|
{% else %}
|
2026-01-08 16:56:19 +01:00
|
|
|
⚠ OIDC app installed but not yet configured.
|
|
|
|
|
|
|
|
|
|
To complete setup:
|
|
|
|
|
1. Ensure Authentik API token is in secrets (authentik_api_token)
|
|
|
|
|
2. Re-run deployment with: --tags authentik,oidc
|
2026-01-06 09:49:16 +01:00
|
|
|
{% endif %}
|