I’d like to run a playbook and have ansible continue on to the next task when a task fails. This way I get a play summary showing exactly how many tasks failed and how many succeeded and I can pick out specific tasks to re-run on specific hosts. AFAIK, the only way to do this is to use ignore_errors:true. But that’s not what I want. ignore_errors causes ansible to show it as “ok” in the play summary. I actually want it to show failed but continue on to the next task. Am I missing something?
Thanks,
Hi Matt,
I would recommend using tags on any tasks that you may want to re-run individually, that way you can limit what is re-run. You can also use the --start-at-task option for ansible-playbook to restart your playbook at a later part of your plays.
Thanks James. I guess I wasn’t clear. I know how to re-run tasks, but my question is more about how to force the playbook to continue on failure without using ignore_errors. I want the output of the run to show how many tasks succeeded and how many failed. Currently it will stop running tasks on a host when there’s a failure.
Ansible internally fails on errors as a key design feature.
Any tasks you want to ignore would need the “ignore_errors: True” flag on those specific tasks.
I’m sorry if you don’t like how that was flagged in the stats, but we can’t change that.