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

8 views
Skip to first unread message

IP Freely

unread,
Jan 25, 2019, 8:25:16 AM1/25/19
to Ansible Project
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

Adam E

unread,
Jan 25, 2019, 12:27:18 PM1/25/19
to Ansible Project
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
Reply all
Reply to author
Forward
0 new messages