---
- name: "π Resolve the Pixelfed container that mints the CI source tokens"
ansible.builtin.include_tasks: "{{ lookup('path_absolute', 'roles/sys-svc-compose/tasks/utils/swarm/resolve_host_cid.yml') }}"
vars:
resolve_service_key: pixelfed
resolve_service_name: "{{ lookup('container_service', 'web-app-pixelfed', 'pixelfed') if IS_SWARM_MODE else '' }}"
resolve_output_prefix: OPENPOST_SEED_PIXELFED
resolve_compose_cid: "{{ lookup('config', 'web-app-pixelfed', 'services.pixelfed.name') }}"
- name: "π Mint a Pixelfed personal access token for each CI route"
ansible.builtin.command:
argv:
- container
- exec
- -i
- -u
- "{{ OPENPOST_PIXELFED_PHP_USER }}"
- -e
- "CROSSPOSTER_ACCOUNT={{ item.source.account }}"
- -e
- "PIXELFED_APP_DIR={{ OPENPOST_PIXELFED_APP_DIR }}"
- "{{ OPENPOST_SEED_PIXELFED_LOCAL_CID }}" # nocheck: container-exec-resolver
- php
stdin: "{{ lookup('file', 'php/pixelfed/mint_token.php') }}"
loop: "{{ openpost_crossposter_seed_missing | selectattr('source.platform', 'equalto', 'pixelfed') | list }}"
loop_control:
label: "{{ item.name }}"
register: openpost_crossposter_pixelfed_minted
changed_when: true
delegate_to: "{{ OPENPOST_SEED_PIXELFED_HOST_NODE }}"
no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}"
- name: "π§Ύ Keep the minted Pixelfed tokens"
ansible.builtin.set_fact:
openpost_crossposter_sources: >-
{%- set _minted = dict(openpost_crossposter_sources) -%}
{%- for _result in openpost_crossposter_pixelfed_minted.results -%}
{%- set _line = _result.stdout_lines | select('match', 'CROSSPOSTER_TOKEN=') | first -%}
{%- set _ = _minted.update({_result.item.name: _line | replace('CROSSPOSTER_TOKEN=', '') | trim}) -%}
{%- endfor -%}
{{ _minted }}
no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}"