# Ansible task always run

**URL:** <https://forum.ansible.com/t/ansible-task-always-run/21100>\
**Category:** Ansible Project\
**Created:** [April 8, 2016, 4:32am UTC](https://forum.ansible.com/t/ansible-task-always-run/21100 "2016-04-08T04:32:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![G\_Joe](https://avatars.discourse-cdn.com/v4/letter/g/3d9bf3/32.png) [@G\_Joe](https://forum.ansible.com/u/G_Joe)\
**Post date:** [April 8, 2016, 4:32am UTC](https://forum.ansible.com/t/ansible-task-always-run/21100/1 "2016-04-08T04:32:41Z")

</div>

Hi…

I’m looking for a way to always run a task at the end of script, even if tasks before that were failed. Is there any option such as always\_run etc.

Please advise.

Thanks.  
GJ

---

<div class="post-metadata">

**Author:** ![Paul\_Totterman](https://avatars.discourse-cdn.com/v4/letter/p/3ec8ea/32.png) [@Paul\_Totterman](https://forum.ansible.com/u/Paul_Totterman)\
**Post date:** [April 8, 2016, 11:40am UTC](https://forum.ansible.com/t/ansible-task-always-run/21100/2 "2016-04-08T11:40:05Z")

</div>

> I’m looking for a way to always run a task at the end of script, even if tasks before that were failed. Is there any option such as always\_run etc.

Yes: [https://docs.ansible.com/ansible/playbooks\_checkmode.html#running-a-task-in-check-mode](https://docs.ansible.com/ansible/playbooks_checkmode.html#running-a-task-in-check-mode) . Probably doesn’t do what you want.

You may want block: always: [https://docs.ansible.com/ansible/playbooks\_blocks.html](https://docs.ansible.com/ansible/playbooks_blocks.html)

Cheers,  
Paul

---

<div class="post-metadata">

**Author:** ![Johannes\_Kastl](https://avatars.discourse-cdn.com/v4/letter/j/bbe5ce/32.png) [@Johannes\_Kastl](https://forum.ansible.com/u/Johannes_Kastl)\
**Post date:** [April 9, 2016, 5:52pm UTC](https://forum.ansible.com/t/ansible-task-always-run/21100/3 "2016-04-09T17:52:03Z")

</div>

I am not an expert, but IMHO this would mean setting "ignore\_errors:  
true" on all tasks before the one that should always run...

Johannes

---

<div class="post-metadata">

**Author:** ![G\_Joe](https://avatars.discourse-cdn.com/v4/letter/g/3d9bf3/32.png) [@G\_Joe](https://forum.ansible.com/u/G_Joe)\
**Post date:** [April 11, 2016, 2:03am UTC](https://forum.ansible.com/t/ansible-task-always-run/21100/4 "2016-04-11T02:03:15Z")

</div>

as aforementioned - blocks: always feature in 2.0 seems to suffice my requirement.

thanks.

---

<div class="post-metadata">

**Author:** ![G\_Joe](https://avatars.discourse-cdn.com/v4/letter/g/3d9bf3/32.png) [@G\_Joe](https://forum.ansible.com/u/G_Joe)\
**Post date:** [April 11, 2016, 2:03am UTC](https://forum.ansible.com/t/ansible-task-always-run/21100/5 "2016-04-11T02:03:51Z")

</div>

thanks. that helped.
