# Skip task in callback\_plugin or stop playbook execution

**URL:** <https://forum.ansible.com/t/skip-task-in-callback-plugin-or-stop-playbook-execution/23221>\
**Category:** Ansible Developer\
**Created:** [December 10, 2016, 6:20am UTC](https://forum.ansible.com/t/skip-task-in-callback-plugin-or-stop-playbook-execution/23221 "2016-12-10T06:20:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mumshad\_Mannambeth](https://avatars.discourse-cdn.com/v4/letter/m/3da27b/32.png) [@Mumshad\_Mannambeth](https://forum.ansible.com/u/Mumshad_Mannambeth)\
**Post date:** [December 10, 2016, 6:20am UTC](https://forum.ansible.com/t/skip-task-in-callback-plugin-or-stop-playbook-execution/23221/1 "2016-12-10T06:20:59Z")

</div>

I would like to skip a task or all tasks conditionally in my callback\_plugin. Is that possible? I am trying to implement a stop playbook feature where I query an external API in my callback\_plugin, and if a stop flag is raised, I would like to skip all remaining tasks in the playbook or simply kill the playbook after the current running task. Note, I need to wait for the current running task to finish before exiting the playbook. Appreciate any ideas.

Is this called before or after the task has actually started?

```auto
def v2_playbook_on_task_start(self, task, is_conditional):
    

```

---

<div class="post-metadata">

**Author:** ![Mumshad\_Mannambeth](https://avatars.discourse-cdn.com/v4/letter/m/3da27b/32.png) [@Mumshad\_Mannambeth](https://forum.ansible.com/u/Mumshad_Mannambeth)\
**Post date:** [December 10, 2016, 7:10am UTC](https://forum.ansible.com/t/skip-task-in-callback-plugin-or-stop-playbook-execution/23221/2 "2016-12-10T07:10:27Z")

</div>

Did some more reading and found out action\_plugin may be the right way to go. Can we have a global action\_plugin that runs before all module executions? So that I can check for a skip flag and skip module executions?

Please advise if there is a better way of going about this.

Thanks

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [December 13, 2016, 7:10pm UTC](https://forum.ansible.com/t/skip-task-in-callback-plugin-or-stop-playbook-execution/23221/3 "2016-12-13T19:10:35Z")

</div>

make your first action

- meta: end\_play  
when: ???

[http://docs.ansible.com/ansible/meta\_module.html](http://docs.ansible.com/ansible/meta_module.html)

---

<div class="post-metadata">

**Author:** ![Mumshad\_Mannambeth](https://avatars.discourse-cdn.com/v4/letter/m/3da27b/32.png) [@Mumshad\_Mannambeth](https://forum.ansible.com/u/Mumshad_Mannambeth)\
**Post date:** [December 17, 2016, 11:44pm UTC](https://forum.ansible.com/t/skip-task-in-callback-plugin-or-stop-playbook-execution/23221/4 "2016-12-17T23:44:13Z")

</div>

Thanks Brian. But wouldn’t I need to include this between every task in my play? Is there a better way to stop my playbook execution from a callback\_plugin or an action\_plugin based on a condition?

Thanks
