From 5289542dca213e6f952060c696f7134e5ea083b9 Mon Sep 17 00:00:00 2001 From: Sergei Poljanski Date: Fri, 13 Nov 2026 04:59:11 +0400 Subject: [PATCH] docker_service: skip health checks in a dry run A dry run changes nothing to verify, and for a service that is not on the host yet the check waited a minute and failed the dry run. Assisted-by: Claude:opus-5-5 --- ansible/roles/docker_service/tasks/main.yaml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ansible/roles/docker_service/tasks/main.yaml b/ansible/roles/docker_service/tasks/main.yaml index 6e144ac..a0cc840 100644 --- a/ansible/roles/docker_service/tasks/main.yaml +++ b/ansible/roles/docker_service/tasks/main.yaml @@ -120,6 +120,7 @@ when: - health_check_enabled - health_check_url != "" or health_check_port != "" + - not ansible_check_mode - compose_result is changed or template_result is changed or file_result is changed - name: Wait for service HTTP endpoint @@ -132,12 +133,16 @@ until: health_result is not failed retries: "{{ health_check_retries }}" delay: "{{ health_check_retry_delay }}" - when: health_check_enabled and health_check_url != "" - check_mode: false + when: + - health_check_enabled and health_check_url != "" + # A dry run changes nothing to verify, and a new service is not there yet + - not ansible_check_mode - name: Wait for service port ansible.builtin.wait_for: host: "{{ health_check_host }}" port: "{{ health_check_port }}" timeout: "{{ health_check_retries * health_check_retry_delay }}" - when: health_check_enabled and health_check_port != "" + when: + - health_check_enabled and health_check_port != "" + - not ansible_check_mode