one task failed doesn't break the rest tasks in other roles

28 views
Skip to first unread message

Tzu Lao

unread,
Aug 17, 2015, 11:44:49 AM8/17/15
to Ansible Project
Hi guys,

I have role X with tasks a,b,c,d.
And I have another role Y with tasks e,f,g,h.
And I have host Z whcih I want to apply role X and role Y to.


If task b failed, how to let ansible continue to working on the rest task(e, f, g, h) in role Y?
Task b failed and I don't want to let ansible run task c and d, 
so "ignore_errors: yes"  is not solution for me.

Thank you for your helping.


Brian Coca

unread,
Aug 17, 2015, 6:04:49 PM8/17/15
to Ansible Project
in 2.0 (current devel) you'll have blocks which will allow this:

block:
- task a
- task b
- task c
- task d
rescue:
- debug: msg=skipping rest of block but continuing with play

which will discontinue errors in that set of tasks but will continue
with rest of the play.


--
Brian Coca

Tzu Lao

unread,
Aug 17, 2015, 10:28:40 PM8/17/15
to Ansible Project
Hi Brian,

Thank you for your helping. The new feature solves my problems.

I can't wait to use ansible v2.

Brian Coca於 2015年8月18日星期二 UTC+8上午6時04分49秒寫道:
Reply all
Reply to author
Forward
0 new messages