need ansible to wait for a springboot acutuator heathcheck to show up

Hi Hope you can help me again

I need to wait for a spring application to start before moving on in my playbook.
when the microservice starts it runs flyway script that can take a long time to run before the service actually starts working.

would the uri module be able to check a specific url for specific text?

so if i wanted to check: localhost:8093/service/actuator/health

for this text:

“status” : “UP”

and not just look for a 200 message?

is this possible? if so how

Many thanks in advance

John

something like this should work

  • name: “wait for status”
    shell: bash -c ‘curl -s http://{{ server_name }}:8093/service/actuator/health |egrep “^status”’
    register: cmd_res
    retries: “60”
    delay: 1
    until: cmd_res.stdout.find('“status”: “UP”) != -1