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
This commit is contained in:
Sergei Poljanski 2026-11-13 04:59:11 +04:00
commit 5289542dca
Signed by: asxpi
GPG key ID: 4F8851660FA4121B

View file

@ -120,6 +120,7 @@
when: when:
- health_check_enabled - health_check_enabled
- health_check_url != "" or health_check_port != "" - 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 - compose_result is changed or template_result is changed or file_result is changed
- name: Wait for service HTTP endpoint - name: Wait for service HTTP endpoint
@ -132,12 +133,16 @@
until: health_result is not failed until: health_result is not failed
retries: "{{ health_check_retries }}" retries: "{{ health_check_retries }}"
delay: "{{ health_check_retry_delay }}" delay: "{{ health_check_retry_delay }}"
when: health_check_enabled and health_check_url != "" when:
check_mode: false - 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 - name: Wait for service port
ansible.builtin.wait_for: ansible.builtin.wait_for:
host: "{{ health_check_host }}" host: "{{ health_check_host }}"
port: "{{ health_check_port }}" port: "{{ health_check_port }}"
timeout: "{{ health_check_retries * health_check_retry_delay }}" 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