--- - 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