mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 10:59:59 +00:00
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>
38 lines
1.5 KiB
YAML
38 lines
1.5 KiB
YAML
---
|
||
- 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
|