04_wait_for_redis.ymlΒΆ

---
- name: "⏳ Probe embedded Mailu redis on its hosting node"
  ansible.builtin.include_tasks: 04_wait_for_redis/probe_local_redis.yml
  when: lookup('engine', 'redis', application_id, 'local')

- name: "πŸ” Resolve Mailu admin hosting node + container id"
  ansible.builtin.include_tasks: "{{ lookup('path_absolute', 'roles/sys-svc-compose/tasks/utils/swarm/resolve_host_cid.yml') }}"
  vars:
    resolve_service_key: admin
    resolve_output_prefix: MAILU_ADMIN
    resolve_compose_cid: "{{ MAILU_ADMIN_CONTAINER_ADDRESS }}"

- name: "πŸ” Probe Mailu admin HTTP API"
  ansible.builtin.shell: |
    # nocheck: container-exec-resolver  runtime-resolved CID, delegated to the hosting node
    container exec -i {{ MAILU_ADMIN_LOCAL_CID | quote }} \
      {{ 30 | curl }} -S -o /dev/null -w "%{http_code}" http://localhost:8080/sso/login
  delegate_to: "{{ MAILU_ADMIN_HOST_NODE }}"
  register: mailu_admin_http_check
  retries: 30
  delay: 5
  until:
    - mailu_admin_http_check.rc == 0
    - (mailu_admin_http_check.stdout | default('') | regex_search('^[1-5][0-9][0-9]$')) is not none
  changed_when: false