# ansible yaml question for retries module

**URL:** <https://forum.ansible.com/t/ansible-yaml-question-for-retries-module/28866>\
**Category:** Ansible Project\
**Created:** [October 24, 2018, 8:21pm UTC](https://forum.ansible.com/t/ansible-yaml-question-for-retries-module/28866 "2018-10-24T20:21:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rajeev](https://avatars.discourse-cdn.com/v4/letter/r/ec9cab/32.png) [@rajeev](https://forum.ansible.com/u/rajeev)\
**Post date:** [October 24, 2018, 8:21pm UTC](https://forum.ansible.com/t/ansible-yaml-question-for-retries-module/28866/1 "2018-10-24T20:21:19Z")

</div>

Hello,

I have a use case where I need drop a long running command(x1) on a remote host and then track its status via another command(x2).  
I have tried doing that using async with Poll “0” for x1 command , and then run retries for the other command(x2) until i see a certain output.

My questions:

1. Is there another alternate to use using retries in this case?

2. Is there a way to:

1. Change the “FAILED RETRYING” to a custom message?.. please note I am using a shared environment and have no flexibility to modify the actual ansible configuration.
2. Display STDOUT from each retry show along with “FAILED RETRYING” ?

Please let me know if I can provide any other details.  
Any assistance is greatly appreciated.

thanks  
Rd

---

<div class="post-metadata">

**Author:** ![Dimon](https://avatars.discourse-cdn.com/v4/letter/d/eb8c5e/32.png) [@Dimon](https://forum.ansible.com/u/Dimon)\
**Post date:** [October 25, 2018, 12:24am UTC](https://forum.ansible.com/t/ansible-yaml-question-for-retries-module/28866/2 "2018-10-25T00:24:09Z")

</div>

my first reaction would be to suggest looking into “until” loop structure. if your module can query for results reutrning some value, until will keep calling it until N retries run out or module will execute successfully

---

<div class="post-metadata">

**Author:** ![rajeev](https://avatars.discourse-cdn.com/v4/letter/r/ec9cab/32.png) [@rajeev](https://forum.ansible.com/u/rajeev)\
**Post date:** [October 25, 2018, 2:28am UTC](https://forum.ansible.com/t/ansible-yaml-question-for-retries-module/28866/3 "2018-10-25T02:28:16Z")

</div>

Hi Dmitry,

Thanks for your response.

I think I should clarify, that I am capturing the result and the do … until logic works fine and does exit the `retries’ based on the the until pattern of the result. However, what I am trying to achieve

1. Either to replace “FAILED RETRYING” with the actual STDOUT of “X2”.

OR

1. To display STDOUT(of X2) along with “FAILED RETRYING” for each retry.

Here is the code for the retry:

- name: Status  
command:   
register: result  
until: result.stdout.find(“complete”) != -1  
retries: 100  
delay: 30

Here is the output on AWX screen, which I want to update to include my stdout.

FAILED - RETRYING: Status check (100 retries left).

FAILED - RETRYING: Status check (99 retries left).

FAILED - RETRYING: Status check (98 retries left).

Note: I did try the debug with retries but it breaks the retry loop.

thanks  
Rd

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [October 25, 2018, 3:41pm UTC](https://forum.ansible.com/t/ansible-yaml-question-for-retries-module/28866/4 "2018-10-25T15:41:46Z")

</div>

Ansible output is controlled by callback plugin you have many you can try  
[https://docs.ansible.com/ansible/2.7/plugins/callback.html#plugin-list](https://docs.ansible.com/ansible/2.7/plugins/callback.html#plugin-list)

If non of them is to you liking you would need to create your own.
