Open LeanderFS opened 2 weeks ago
Another idea would be to (also) have a separate module which allows to wait for several contains at once to reach the healthy state. That would allow users to start several containers first with the docker_container module, and then wait until all of them are healthy afterwards. This is likely faster than waiting for each to be healthy before starting the next.
Your case can then also be split up into just two tasks (without any explicit polling).
Obviously that doesn't mean that a state=healthy
(or something similar) doesn't make sense / shouldn't be implemented, I think it's just more flexible to also have a separate module for just waiting :)
SUMMARY
Currently it's only possible to use state
absent
,present
,stopped
andstarted
for the docker_container module. I would like to propose addingstate: healthy
to have Ansible wait until the integrated HEALTHCHECK returns healthy (when defined in the Dockerfile).ISSUE TYPE
COMPONENT NAME
community.docker.docker_container
ADDITIONAL INFORMATION
By implementing this feature, a playbook can halt execution until the docker_container healtcheck returns healthy. This prevents additional tasks to poll for the health manually.