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:
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
- some_module: ...
register: tertiary_result
when: primary_result|failed and secondary_result|failed
Hope that helps!