01_manager_ops.ymlΒΆ

---
- name: "βœ… Ensure Fediwall build dir '{{ FEDIWALL_BUILD_DIR_ABS }}' exists"
  file:
    path: "{{ FEDIWALL_BUILD_DIR_ABS }}"
    state: directory
    mode: "0755"

- name: "⬇️ Download Fediwall {{ FEDIWALL_UPSTREAM_VERSION }} release tarball"
  get_url_retry:
    url: "{{ FEDIWALL_UPSTREAM_TARBALL_URL }}"
    dest: "{{ FEDIWALL_TARBALL_FILE }}"
    mode: "0644"
  notify:
    - compose-build
    - compose-up

- name: "βœ… Ensure Fediwall upstream dir '{{ FEDIWALL_UPSTREAM_DIR_ABS }}' exists"
  file:
    path: "{{ FEDIWALL_UPSTREAM_DIR_ABS }}"
    state: directory
    mode: "0755"

- name: "πŸ“€ Extract Fediwall tarball into '{{ FEDIWALL_UPSTREAM_DIR_ABS }}'"
  unarchive:
    src: "{{ FEDIWALL_TARBALL_FILE }}"
    dest: "{{ FEDIWALL_UPSTREAM_DIR_ABS }}"
    remote_src: true
    extra_opts:
      - --strip-components=1
  notify:
    - compose-build
    - compose-up

- name: "πŸ”§ De-hardcode https in the Fediwall SPA bundles (HTTP-only)"
  when: FEDIWALL_HTTP_ONLY_ENABLED | bool
  block:
    - name: "πŸ” Find built Fediwall JS bundles to de-hardcode https"
      find:
        paths: "{{ [ FEDIWALL_UPSTREAM_DIR_ABS, 'assets' ] | path_join }}"
        patterns: "*.js"
      register: _fediwall_assets

    - name: "✏️ Rewrite the SPA's hardcoded https:// API scheme to the page's own protocol"
      replace:
        path: "{{ item.path }}"
        regexp: '"https://"\.concat'
        replace: '(location.protocol+"//").concat'
      loop: "{{ _fediwall_assets.files | default([]) }}"
      loop_control:
        label: "{{ item.path | basename }}"
      notify:
        - compose-build
        - compose-up

- name: "🧹 Wipe Fediwall dist tree '{{ FEDIWALL_DIST_DIR_ABS }}' to drop removed slugs"
  file:
    path: "{{ FEDIWALL_DIST_DIR_ABS }}"
    state: absent

- name: "πŸ“ Recreate Fediwall dist tree '{{ FEDIWALL_DIST_DIR_ABS }}'"
  file:
    path: "{{ FEDIWALL_DIST_DIR_ABS }}"
    state: directory
    mode: "0755"

- name: "🎬 Stage upstream Fediwall files into per-slug folder '{{ wall.slug }}'"
  copy: # nocheck: stack-host-consumer (01_manager_ops.yml is parent-gated by IS_STACK_HOST in 00_core.yml:11)
    src: "{{ FEDIWALL_UPSTREAM_DIR_ABS }}/"
    dest: "{{ [ FEDIWALL_DIST_DIR_ABS, wall.slug ] | path_join }}/"
    remote_src: true
    mode: preserve
  loop: "{{ FEDIWALL_WALLS }}"
  loop_control:
    loop_var: wall
    label: "{{ wall.slug }}"
  notify:
    - compose-build
    - compose-up

- name: "πŸ“„ Render per-slug Fediwall wall-config.json for '{{ wall.slug }}'"
  stack_host_template:
    src: "wall-config.json.j2"
    dest: "{{ [ FEDIWALL_DIST_DIR_ABS, wall.slug, 'wall-config.json' ] | path_join }}"
    mode: "0644"
  loop: "{{ FEDIWALL_WALLS }}"
  loop_control:
    loop_var: wall
    label: "{{ wall.slug }}"
  notify:
    - compose-build
    - compose-up

- name: "πŸ“„ Render Fediwall root link list at '{{ FEDIWALL_DIST_DIR_ABS }}/index.html'"
  stack_host_template:
    src: "index.html.j2"
    dest: "{{ [ FEDIWALL_DIST_DIR_ABS, 'index.html' ] | path_join }}"
    mode: "0644"
  notify:
    - compose-build
    - compose-up

- name: "🚿 flush compose for '{{ application_id }}'"
  meta: flush_handlers