Thanks James. It does help. I think your second solution is the most 
appropriate for this case.

--Pedro.

On Thursday, 20 November 2014 19:11:11 UTC, James Cammarata wrote:
>
> Hi Pedro, 
>
> You can use the retry/until mechanism to re-execute a task a set number of 
> times, however you cannot change the underlying variables you send to the 
> task during each retry:
>
> http://docs.ansible.com/playbooks_loops.html#do-until-loops
>
> Alternatively, you could use a delegate_to and a when statement to have 
> several tasks that are only run if the previous one failed, so that the 
> second tasks would be delegated to the secondary/tertiary servers if need 
> be. For example:
>
> - some_module: ...
>   register: primary_result
>   ignore_errors: yes
>
> - some_module: ...
>   register: secondary_result
>   when: primary_result|failed
>   ignore_errors: yes
>
> - some_module: ...
>   register: tertiary_result
>   when: primary_result|failed and secondary_result|failed
>
> Hope that helps!
>
> On Thu, Nov 20, 2014 at 12:16 PM, Pedro Romano <[email protected] 
> <javascript:>> wrote:
>
>> For tasks that depend, for example, on remote servers, it would be very 
>> useful to be able to retry the task with a list of items for the remote 
>> server names until the task was successful. This would enable defining 
>> secondary/fallback servers easily. Is there any elegant way to this with 
>> Ansible currently?
>>
>> -- 
>> 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] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/da9e06af-1480-4fdd-af33-0563c18f2d8b%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/da9e06af-1480-4fdd-af33-0563c18f2d8b%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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/69b126ba-78a0-408a-ab25-786e98915d32%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to