# How to execute one task/role if all others exit with 0

**URL:** <https://forum.ansible.com/t/how-to-execute-one-task-role-if-all-others-exit-with-0/27669>\
**Category:** Ansible Project\
**Created:** [May 30, 2018, 10:21pm UTC](https://forum.ansible.com/t/how-to-execute-one-task-role-if-all-others-exit-with-0/27669 "2018-05-30T22:21:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Venkatsm\_V](https://avatars.discourse-cdn.com/v4/letter/v/b2d939/32.png) [@Venkatsm\_V](https://forum.ansible.com/u/Venkatsm_V)\
**Post date:** [May 30, 2018, 10:21pm UTC](https://forum.ansible.com/t/how-to-execute-one-task-role-if-all-others-exit-with-0/27669/1 "2018-05-30T22:21:04Z")

</div>

I have a play with multiple section. I want to execute all sections and execute the final section only all above are success.

- name: pre-step of the setup process  
hosts: HostSet  
gather\_facts: false  
strategy: free  
any\_errors\_fatal: true  
tasks:

- include : roles/setup\_node/tasks/pre-setup.yml

- name: setup process  
hosts: HostSet  
gather\_facts: false  
strategy: free  
any\_errors\_fatal: true  
role:

- setup\_node

- name: post-step of the setup process  
hosts: HostSet  
gather\_facts: false  
strategy: free  
any\_errors\_fatal: true  
tasks:

- include : roles/setup\_node/tasks/post-setup.yml

- name: Update DB for cluster ready  
hosts: DBHosts  
gather\_facts: false  
strategy: free  
any\_errors\_fatal: true  
tasks:

- include : roles/setup\_node/tasks/db\_update.yml
