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]> 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]. > 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/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/CAMFyvFhh1mvnKNoho9hhzQRiNbErQ6%2Braj50mXJyfgdEBVZaig%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
