Files
computer-playbook/roles/web-app-gitea/tasks/setup/ldap.yml
kevinveenbirkenbachandClaude Opus 4.8 99bc9a94d9 fix(web-app-gitea): delegate ldap/oidc auth exec to host node
In swarm the ldap/oidc setup+cleanup 'container exec' tasks used
GITEA_CONTAINER_ADDRESS (a swarm-wide-resolved container id) and ran on
the manager without delegation. When gitea is scheduled on a worker,
'docker exec' is node-local, so the manager's daemon can't see that
container -> 'No such container', failing the deploy.

Bring these tasks to parity with the DB/manager-ops tasks (commit
6a5cf7b66): use GITEA_LOCAL_CID + delegate_to GITEA_HOST_NODE (facts
already set by resolve_host_cid.yml in 01_manager_ops before setup/
cleanup run), with the container-exec-resolver nocheck marker. Applies
to every exec incl. the id-lookup steps, else idempotency/cleanup
misfire on worker placement.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-25 15:31:13 +02:00

38 lines
1.5 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
- name: "➕ Add LDAP Authentication Source"
shell: | # nocheck: container-exec-resolver runtime-resolved CID, delegated to the hosting node
container exec -i --user {{ GITEA_USER }} {{ GITEA_LOCAL_CID | quote }} \
gitea admin auth add-ldap \
{{ GITEA_LDAP_AUTH_ARGS | join(' ') }}
delegate_to: "{{ GITEA_HOST_NODE }}"
register: ldap_manage
failed_when: ldap_manage.rc != 0 and not (ldap_manage.stderr | gitea_auth_noop)
- name: "🔍 Lookup existing LDAP auth source ID"
shell: | # nocheck: container-exec-resolver runtime-resolved CID, delegated to the hosting node
container exec -i --user {{ GITEA_USER }} {{ GITEA_LOCAL_CID | quote }} \
gitea admin auth list \
| tail -n +2 \
| grep -F "LDAP ({{ DOMAIN_PRIMARY }})" \
| awk '{print $1; exit}'
delegate_to: "{{ GITEA_HOST_NODE }}"
register: ldap_source_id_raw
failed_when:
- ldap_source_id_raw.rc != 0
- ldap_source_id_raw.stdout == ""
changed_when: false
- name: "🔧 Set LDAP source ID fact"
set_fact:
ldap_source_id: "{{ ldap_source_id_raw.stdout }}"
- name: "🔄 Update LDAP Authentication Source"
shell: | # nocheck: container-exec-resolver runtime-resolved CID, delegated to the hosting node
container exec -i --user {{ GITEA_USER }} {{ GITEA_LOCAL_CID | quote }} \
gitea admin auth update-ldap \
--id {{ ldap_source_id }} \
{{ GITEA_LDAP_AUTH_ARGS | join(' ') }}
delegate_to: "{{ GITEA_HOST_NODE }}"
register: ldap_manage
failed_when: ldap_manage.rc != 0