mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 10:59:59 +00:00
user_token.yml moved to tasks/utils/manage/ during the task-file renumbering, but its include of create_user_token.yml kept a single '../', resolving to the non-existent tasks/utils/05_manage_user/ and collapsing to /opt/src/05_manage_user/ at deploy time. Every app that pulls in mailu (fusiondirectory, kix, odoo, openproject, penpot, pgadmin, peertube, xwiki, logout) failed on it. Use '../../' to reach tasks/05_manage_user/create_user_token.yml. Add tests/lint/ansible/tasks/test_relative_includes_resolve.py to guard the class: it parses every role tasks file and asserts each relative include_tasks/import_tasks/include_vars path resolves through ansible's search bases, so a moved task or vars file can no longer leave a dangling include that only surfaces at deploy time. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
37 lines
1.3 KiB
YAML
37 lines
1.3 KiB
YAML
---
|
|
- name: "⬇️ Fetch existing API tokens via curl inside admin container"
|
|
ansible.builtin.shell: >-
|
|
container exec -i {{ MAILU_ADMIN_CONTAINER_ADDRESS }}
|
|
{{ 30 | curl }} -S --fail -X GET {{ MAILU_API_SERVICE_BASE_URL }}/token
|
|
-H "Authorization: Bearer {{ MAILU_API_TOKEN }}"
|
|
register: mailu_tokens_cli
|
|
changed_when: false
|
|
no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}"
|
|
retries: 30
|
|
delay: 2
|
|
until: mailu_tokens_cli.rc == 0 and mailu_tokens_cli.stdout | trim | length > 0
|
|
timeout: "{{ lookup('timeout', 120) | int }}"
|
|
|
|
- name: "📤 Extract existing token info for '{{ mailu_user_key }};{{ mailu_user_name }}'"
|
|
set_fact:
|
|
mailu_user_existing_token: >-
|
|
{{ (
|
|
mailu_tokens_cli.stdout
|
|
| from_json
|
|
| selectattr('comment','equalto', mailu_token_name)
|
|
| list
|
|
).0 | default(None) }}
|
|
|
|
- name: "▶️ Start Mailu token procedures if token missing locally or absent in Mailu"
|
|
when: >-
|
|
(
|
|
(
|
|
lookup('users').get(mailu_user_key, {}).get('tokens', {}).get(application_id, '')
|
|
| string | trim
|
|
) == ''
|
|
) or (mailu_user_existing_token is none)
|
|
ansible.builtin.include_tasks:
|
|
file: ../../05_manage_user/create_user_token.yml
|
|
apply:
|
|
no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}"
|