# Run Handlers like a task

**URL:** <https://forum.ansible.com/t/run-handlers-like-a-task/19943>\
**Category:** Ansible Project\
**Created:** [December 4, 2015, 6:06pm UTC](https://forum.ansible.com/t/run-handlers-like-a-task/19943 "2015-12-04T18:06:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![smalenfant](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/smalenfant/32/2389_2.png) [@smalenfant](https://forum.ansible.com/u/smalenfant)\
**Post date:** [December 4, 2015, 6:06pm UTC](https://forum.ansible.com/t/run-handlers-like-a-task/19943/1 "2015-12-04T18:06:13Z")

</div>

We have playbook that didn’t have the force\_handlers directive. They ended up failing and of course, they re-run instead and the handlers never got run for completed tasks.

I’ve searched but couldn’t find something related to run a specific tasks which would be the handler itself. Something nice would be :

ansible-playbook book.yml --run-handler “My handler”

Anything similar to do that?

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 5, 2015, 6:39am UTC](https://forum.ansible.com/t/run-handlers-like-a-task/19943/2 "2015-12-05T06:39:10Z")

</div>

no, but you can try something like this:

```auto
- debug: msg="execute {{handler}}"
  changed_when: True
  when: handler is defined
  notify: "{{handler}}"
  tags: ['handler']

```

then use `--tags 'handler' -e 'handler="name of handler"' ` on the command line

---

<div class="post-metadata">

**Author:** ![smalenfant](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/smalenfant/32/2389_2.png) [@smalenfant](https://forum.ansible.com/u/smalenfant)\
**Post date:** [December 7, 2015, 3:41pm UTC](https://forum.ansible.com/t/run-handlers-like-a-task/19943/3 "2015-12-07T15:41:42Z")

</div>

Thanks, that can be useful.
