--- # Health Check Tasks - name: Get container status ansible.builtin.shell: | cd {{ application_code_dest }} docker compose -f docker-compose.base.yml -f docker-compose.{{ application_compose_suffix }} ps {{ application_container_status_services | default('queue-worker web scheduler php') }} register: container_status changed_when: false - name: Display container status ansible.builtin.debug: msg: | {{ container_status.stdout }} when: application_show_status | default(true) | bool - name: Get queue-worker logs (last N lines) ansible.builtin.shell: | cd {{ application_code_dest }} docker compose -f docker-compose.base.yml -f docker-compose.{{ application_compose_suffix }} logs --tail={{ application_health_check_logs_tail | default(20) }} queue-worker 2>&1 || true register: queue_worker_logs changed_when: false - name: Display queue-worker logs ansible.builtin.debug: msg: | ================ Queue-Worker Logs: ================ {{ queue_worker_logs.stdout }} when: application_show_status | default(true) | bool - name: Get scheduler logs (last N lines) ansible.builtin.shell: | cd {{ application_code_dest }} docker compose -f docker-compose.base.yml -f docker-compose.{{ application_compose_suffix }} logs --tail={{ application_health_check_logs_tail | default(20) }} scheduler 2>&1 || true register: scheduler_logs changed_when: false - name: Display scheduler logs ansible.builtin.debug: msg: | ================ Scheduler Logs: ================ {{ scheduler_logs.stdout }} when: application_show_status | default(true) | bool - name: Get web container logs (last N lines) ansible.builtin.shell: | cd {{ application_code_dest }} docker compose -f docker-compose.base.yml -f docker-compose.{{ application_compose_suffix }} logs --tail={{ application_health_check_logs_tail | default(20) }} web 2>&1 || true register: web_logs changed_when: false - name: Display web container logs ansible.builtin.debug: msg: | ================ Web Container Logs: ================ {{ web_logs.stdout }} when: application_show_status | default(true) | bool - name: Get all container status (final status check) ansible.builtin.shell: | cd {{ application_code_dest }} docker compose -f docker-compose.base.yml -f docker-compose.{{ application_compose_suffix }} ps register: all_containers changed_when: false when: application_health_check_final | default(false) | bool - name: Display all container status (final) ansible.builtin.debug: msg: | {{ all_containers.stdout }} when: - application_health_check_final | default(false) | bool - application_show_status | default(true) | bool