Files
computer-playbook/roles/web-app-gitea/tasks/cleanup/ldap.yml
kevinveenbirkenbachandClaude Opus 5 386f27e901 fix(web-app-gitea): hoist delegate_to to apply:
Commit 99bc9a94d gave every top-level task in cleanup/ldap.yml and cleanup/oidc.yml an identical delegate_to, tripping the include-uniform-apply-keyword lint and failing CI run 30160077828.

apply: on include_tasks wraps the included tasks in a Block, and delegate_to is Block-valid, so hoisting it to the include site is semantically identical: register still resolves on the original host, the per-task when: gate is unaffected, and the include-site when: does not leak into the block. Leaf-only keywords (failed_when/changed_when) stay per-task per 64eef3440.

Matches the established pattern in keycloak, mediawiki, mastodon, matomo, espocrm, collabora and shopware. setup/ldap.yml and setup/oidc.yml deliberately keep the per-task form, since their undelegated set_fact must not run on the hosting node.

make quality green: test-external, test-integration, test-lint, test-unit all pass.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-25 16:17:31 +02:00

18 lines
820 B
YAML

---
- name: "🔍 Lookup existing LDAP auth source ID"
shell: | # nocheck: container-exec-resolver runtime-resolved CID, delegated at the include site
container exec -i --user {{ GITEA_USER }} {{ GITEA_LOCAL_CID | quote }} \
gitea admin auth list \
| awk -v name="LDAP ({{ SOFTWARE_NAME }})" '$0 ~ name {print $1; exit}'
register: ldap_source_id_raw
failed_when: false
changed_when: false
- name: "🗑️ Delete existing LDAP auth source if present"
shell: | # nocheck: container-exec-resolver runtime-resolved CID, delegated at the include site
container exec -i --user {{ GITEA_USER }} {{ GITEA_LOCAL_CID | quote }} \
gitea admin auth delete --id {{ ldap_source_id_raw.stdout }}
when: ldap_source_id_raw.stdout != ""
register: ldap_delete
failed_when: ldap_delete.rc != 0