You need to `register` a variable on the task as well.  Such as:

- name: health check - wait for endpoints to become available
  shell: curl "{{ item.endpoint }}/health"
  register: endpoint_health
  failed_when: endpoint_health.attempts > 5
  retries: 6
  delay: 10

Additionally, I notice that you are using `item.endpoint`, which indicates
that you are using something such as `with_items`, but you did not include
this on your task.

On Tue, Dec 29, 2015 at 8:59 AM, jepper <[email protected]> wrote:

> Hi, please can someone explain to me how to use "attempts" with retries?
> E.g. here's what I want to do:
>
> - name: health check - wait for endpoints to become available
>   action: shell curl "{{ item.endpoint }}/health"
>   failed_when: attempts > 5
>   retries: 6
>   delay: 10
>
> For reference: http://docs.ansible.com/ansible/playbooks_loops.html
> mentions said attempts key.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/18c909f5-8613-4210-8677-61fac50e85c9%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/18c909f5-8613-4210-8677-61fac50e85c9%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Matt Martz
@sivel
sivel.net

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAD8N0v9CAMiRt5MadH7ERkkUOTiiJQZzPJD%3DzmK33w3pr9x40g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to