failed_when to fail after retries have been used

354 views
Skip to first unread message

jepper

unread,
Dec 18, 2015, 7:01:23 AM12/18/15
to Ansible Project
I am looking for a way for below to cause a failure, if the health check fails to see an "UP" message after 10 attempts.

- name: health check - wait for endpoints to become available
  action: shell curl http://endpoint/health"
  register: curl_output
  until: curl_output.stdout.find("UP") > -1
  changed_when: false
  retries: 10
  delay: 10


J Hawkesworth

unread,
Dec 20, 2015, 4:11:26 AM12/20/15
to Ansible Project
Could you add a task straight after to use the assert module to check the contents of curl_output?

Jon

jepper

unread,
Dec 28, 2015, 5:17:04 AM12/28/15
to Ansible Project
I may try to check the value of "attempts", and fail the task if we reach 10 attempts. 
Reply all
Reply to author
Forward
0 new messages