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:
Is there another alternate to use using retries in this case?
Is there a way to:
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.
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.
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
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
Either to replace “FAILED RETRYING” with the actual STDOUT of “X2”.
OR
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.