Continu running tasks after a failure without ignoring?

2,817 views
Skip to first unread message

Matt Madrid

unread,
Oct 21, 2014, 3:59:27 PM10/21/14
to ansible...@googlegroups.com
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,

--
Matt M.

James Cammarata

unread,
Oct 23, 2014, 11:22:09 AM10/23/14
to ansible...@googlegroups.com
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.


--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/460413de-e7b8-4a03-a97d-492d6b2a4ebc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Matt Madrid

unread,
Oct 23, 2014, 7:14:56 PM10/23/14
to ansible...@googlegroups.com
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.

Michael DeHaan

unread,
Oct 24, 2014, 9:33:59 AM10/24/14
to ansible...@googlegroups.com
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.



Reply all
Reply to author
Forward
0 new messages