sorin
sorin

Reputation: 170846

Is there a generic way to retry ansible jobs that get failed?

I observed that usually ansible sets failed: true inside the result (register: result) for failed tasks.

Still, I also observed that this does not set failed: false for successful tasks so I cannot use until: not result.failed.

This makes me think that this should work:

until: 'failed' not in result or not result.failed
restries: 3
delay: 30

So, is this the only generic way retry ansible tasks?

Upvotes: 3

Views: 982

Answers (1)

Konstantin Suvorov
Konstantin Suvorov

Reputation: 68339

There are failed/failure and success/succeeded filters.

You can use until: result | success

Upvotes: 2

Related Questions