re-run failed tasks

Hi,

Is it possible to re-run failed tasks?

Ex: I have 10 tasks, task #9 failed. The next time I run, I only want to run task #9 only.

This is very helpful for development of the playbook. Do you know if we can do this already?

Thanks,
Kien

ansible-playbook has a --start-at-task option which you could use with --step to terminate it after it ran just that one task.

Alternatively, you can use --tags to run just specific sets of tasks. If your playbook is configured to be able to be easily rerunnable, running previous steps won’t cause any problems, but the above steps can save time.

–tags are preferred and easier to use in most cases, as you can say “–tags provision” or “–tags config” or “–tags apache” to quickly select groups of tasks, or even multiples with “–tags apache:redis” and so forth.

(I should also mention a useful but unrelated feature, when ansible playbooks fail, they generate a retry file and output information about this retry file at the end of the standard output about the playbook run. Running ansible again with the suggested parameters will only talk to hosts that have failed in the previous run, skipping hosts that were 100% successful)

Hi,

Does ansible-tower has this option to rerun from the failed task?

If so, please let me know the process to do in TOWER.

Thanks in advance.