How to continue execution on failed task after fixing error in playbook?


When writing and debugging Ansible playbooks, typical workflow is as follows:

  1. ansible-playbook ./main.yaml
  2. Playbook fails on some task
  3. Fix this task and repeat line 1, waiting for all previous tasks to execute again. Which takes a lot of time

Ideally, i’d like to resume execution on failed task, having inventory and all facts collected by previous tasks. Is it even possible? How to make playbook writing/debugging faster?


Take a look at Executing playbooks for troubleshooting.
If you want to start executing your playbook at a particular task, you can do so with the --start-at-task option:

The above will start executing your playbook at a task named “install packages”.

When a play fails, it usually gives you something along the lines of:

Use that --limit command and it should retry from the failed task.

Leave a Reply