Files
computer-playbook/roles/web-app-openproject/tasks/04_admin.yml
kevinveenbirkenbachandClaude Opus 4.8 4039313266 refactor(tasks): enforce and apply a single task-file numbering scheme
Add tests/lint/repository/test_task_file_numbering.py: numbered task
files use exactly two leading digits, a numbered *_core.yml must be
00_core.yml, per directory the numbers are unique/consecutive and start
at 01 (00 with a core file), numbered includes appear in ascending
order, and shared helpers live in tasks/utils/ instead of the numbered
chain.

Apply it across every role: rename NN_core.yml to 00_core.yml with a
consecutive down-shift of the siblings, move letter-suffix children into
a subdirectory named after their parent task, relocate helpers included
from more than one place into tasks/utils/, and update every reference
(include_tasks, path_absolute, .ansible-lint-ignore, requirement docs).
Legacy narration comments in the touched files are deleted; the upstream
xwiki.properties reference block opts out via nocheck. The unused
MAILU_IP6_PUBLIC var (only ever named in now-removed comments) is dropped.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-23 20:01:31 +02:00

48 lines
1.9 KiB
YAML

---
- name: "🔍 Resolve openproject web hosting node + container id"
ansible.builtin.include_tasks: "{{ lookup('path_absolute', 'roles/sys-svc-compose/tasks/utils/swarm/resolve_host_cid.yml') }}"
vars:
resolve_service_key: web
resolve_output_prefix: OPENPROJECT_WEB
resolve_compose_cid: "{{ OPENPROJECT_WEB_CONTAINER_ADDRESS }}"
- name: ✅ Ensure administrator user exists and is admin
ansible.builtin.command:
argv:
- container
- exec
- -i
- -e
- "OPENPROJECT_ADMIN_PASSWORD={{ OPENPROJECT_ADMINISTRATOR_PASSWORD }}"
- -e
- "OPENPROJECT_ADMIN_LOGIN={{ OPENPROJECT_ADMINISTRATOR_USERNAME }}"
- -e
- "OPENPROJECT_ADMIN_EMAIL={{ OPENPROJECT_ADMINISTRATOR_EMAIL }}"
- "{{ OPENPROJECT_WEB_LOCAL_CID }}" # nocheck: container-exec-resolver CID resolved at delegate_to runtime; container_address targets a manager-only subshell
- bash
- -lc
- "cd /app && bundle exec rails runner -"
stdin: "{{ lookup('file', 'ruby/ensure_admin_user.rb') }}"
delegate_to: "{{ OPENPROJECT_WEB_HOST_NODE }}"
no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}"
- name: 🔧 Link admin to LDAP auth source so trusted-header bridge can resolve it
ansible.builtin.command:
argv:
- container
- exec
- -i
- -e
- "OPENPROJECT_LDAP_NAME={{ OPENPROJECT_LDAP.name }}"
- -e
- "OPENPROJECT_ADMIN_LOGIN={{ OPENPROJECT_ADMINISTRATOR_USERNAME }}"
- "{{ OPENPROJECT_WEB_LOCAL_CID }}" # nocheck: container-exec-resolver CID resolved at delegate_to runtime; container_address targets a manager-only subshell
- bash
- -lc
- "cd /app && bundle exec rails runner -"
stdin: "{{ lookup('file', 'ruby/link_admin_to_ldap.rb') }}"
delegate_to: "{{ OPENPROJECT_WEB_HOST_NODE }}"
when: OPENPROJECT_HEADER_SSO_ENABLED | bool
register: openproject_ldap_link
changed_when: "'Linked' in openproject_ldap_link.stdout"