Files
computer-playbook/roles/web-app-friendica/tasks/03_addons.yml
kevinveenbirkenbachandClaude Opus 5 3cc032fd1e refactor(layout): fold the persisted-credential patches into a patch/ folder
1f870b1e5 left two marks the layout rules reject. friendica's utils/ held
patch_config.yml beside patch_db_credentials.yml, which is a shared
delimiter-bounded prefix, and its numbered files ran 00, 01, 02, 04, 05 with
nothing at 03 after the config patch moved out of the sequence.

The prefix becomes the folder it was standing in for, the way 8e8dbbd08c did it
for the AI files. All four roles move, not only the one the lint could see: the
path post_deploy.yml resolves a role's declaration through has to read the same
everywhere, so a folder in one role and a prefix in the other three would be no
domain at all.

  utils/patch_db_credentials.yml -> utils/patch/db_credentials.yml   (4 roles)
  utils/patch_config.yml         -> utils/patch/config.yml           (friendica)

The numbers close up behind the file that left: 04_addons and 05_user_bootstrap
become 03 and 04.

Four references follow: the include in 01_manager_ops.yml, the lookup in
post_deploy.yml, the caller path in the unit test that reads each role's
declaration, and a requirement doc that linked the old addon file.

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

118 lines
4.6 KiB
YAML

---
- name: 🔄 flush handlers so friendica is up before addon configuration
meta: flush_handlers
- name: 🔨 Build friendica_addons from meta/addons/ declarations
set_fact:
friendica_addons: >-
{{
friendica_addons | default([])
+ [{
'name': item.key,
'enabled': (item.value.enabled | bool)
}]
}}
loop: "{{ FRIENDICA_ADDONS | dict2items }}"
loop_control:
label: "{{ item.key }}"
- name: ⏳ Wait until Friendica console + composer vendor tree is fully populated
shell: >
container exec -i --user {{ FRIENDICA_USER }}
--workdir {{ FRIENDICA_APPLICATION_DIR }}
{{ FRIENDICA_LOCAL_CID | quote }}
{{ FRIENDICA_APPLICATION_DIR }}/bin/console list
delegate_to: "{{ FRIENDICA_HOST_NODE }}"
register: friendica_console_ready
changed_when: false
failed_when: false
retries: 90
delay: 2
until: friendica_console_ready.rc == 0
- name: ⏳ Wait until Friendica database is ready and populated
shell: >
container exec -i --user {{ FRIENDICA_USER }}
--workdir {{ FRIENDICA_APPLICATION_DIR }}
{{ FRIENDICA_LOCAL_CID | quote }}
{{ FRIENDICA_APPLICATION_DIR }}/bin/console addon list all
delegate_to: "{{ FRIENDICA_HOST_NODE }}"
register: friendica_db_ready
changed_when: false
failed_when: false
retries: 90
delay: 2
until:
- friendica_db_ready.rc == 0
- "'not ready' not in (friendica_db_ready.stderr | default(''))"
- "'not populated' not in (friendica_db_ready.stderr | default(''))"
- name: ✅ Ensure Friendica DB schema is current
shell: >
container exec -i --user {{ FRIENDICA_USER }}
--workdir {{ FRIENDICA_APPLICATION_DIR }}
{{ FRIENDICA_LOCAL_CID | quote }}
{{ FRIENDICA_APPLICATION_DIR }}/bin/console dbstructure update
delegate_to: "{{ FRIENDICA_HOST_NODE }}"
register: friendica_dbstructure_update
changed_when: "'No tables need to be changed' not in friendica_dbstructure_update.stdout"
- name: "🩹 Patch upstream friendica-addons/ldapauth autocreate return shape"
script: >- # nocheck: container-exec-resolver FRIENDICA_LOCAL_CID resolved at delegate_to runtime
shell/patch_ldapauth_autocreate.sh "container exec -i --user root {{ FRIENDICA_LOCAL_CID | quote }}"
"{{ FRIENDICA_APPLICATION_DIR }}/addon/ldapauth/ldapauth.php"
args:
executable: /bin/bash
delegate_to: "{{ FRIENDICA_HOST_NODE }}"
register: friendica_ldapauth_patch
changed_when: "'PATCHED' in friendica_ldapauth_patch.stdout"
when: FRIENDICA_LDAP_ENABLED | bool
- name: ✅ Ensure Friendica addons are in sync
script: >- # nocheck: container-exec-resolver FRIENDICA_LOCAL_CID resolved at delegate_to runtime
shell/sync_addon.sh "container exec -i --user {{ FRIENDICA_USER }} --workdir {{ FRIENDICA_APPLICATION_DIR }} {{ FRIENDICA_LOCAL_CID | quote }} {{ FRIENDICA_APPLICATION_DIR
}}/bin/console"
"{{ item.name }}"
"{{ 'true' if item.enabled else 'false' }}"
args:
executable: /bin/bash
delegate_to: "{{ FRIENDICA_HOST_NODE }}"
register: friendica_addon_sync
changed_when: friendica_addon_sync.rc == 0
retries: 20
delay: 3
until: friendica_addon_sync.rc == 0
loop: "{{ friendica_addons }}"
loop_control:
label: "{{ item.name }}"
- name: ⏳ Wait until Friendica `hook` table is provisioned
ansible.builtin.shell: >- # nocheck: container-exec-resolver FRIENDICA_LOCAL_CID resolved at delegate_to runtime
container exec -i --user {{ FRIENDICA_USER }} --workdir {{ FRIENDICA_APPLICATION_DIR }} {{ FRIENDICA_LOCAL_CID | quote }} php --
args:
stdin: "{{ lookup('file', role_path + '/files/php/probe_hook_table.php') }}"
delegate_to: "{{ FRIENDICA_HOST_NODE }}"
register: friendica_hook_table_ready
changed_when: false
failed_when: false
retries: 60
delay: 2
until: friendica_hook_table_ready.rc == 0
when: FRIENDICA_LDAP_ENABLED | bool
- name: ✅ Verify ldapauth hooks are registered (re-cycle if missing)
ansible.builtin.shell: >- # nocheck: container-exec-resolver FRIENDICA_LOCAL_CID resolved at delegate_to runtime
container exec -i --user {{ FRIENDICA_USER }} --workdir {{ FRIENDICA_APPLICATION_DIR }} {{ FRIENDICA_LOCAL_CID | quote }} php -- ldapauth 2
args:
stdin: "{{ lookup('file', role_path + '/files/php/verify_addon_hooks.php') }}"
delegate_to: "{{ FRIENDICA_HOST_NODE }}"
changed_when: false
when: FRIENDICA_LDAP_ENABLED | bool
- name: "▶️ Run per-addon integration hooks for enabled addons"
include_tasks: "addons/{{ item.name }}.yml"
loop: "{{ friendica_addons | selectattr('enabled') | list }}"
loop_control:
label: "{{ item.name }}"
when: (role_path ~ '/tasks/addons/' ~ item.name ~ '.yml') is exists