# Handlers called but not working

**URL:** <https://forum.ansible.com/t/handlers-called-but-not-working/28819>\
**Category:** Ansible Project\
**Tags:** rhel\
**Created:** [October 18, 2018, 2:01pm UTC](https://forum.ansible.com/t/handlers-called-but-not-working/28819 "2018-10-18T14:01:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![LeamHall](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/leamhall/32/9390_2.png) [@LeamHall](https://forum.ansible.com/u/LeamHall)\
**Post date:** [October 18, 2018, 2:01pm UTC](https://forum.ansible.com/t/handlers-called-but-not-working/28819/1 "2018-10-18T14:01:55Z")

</div>

In the ansible output it says:

META: ran handlers

For this role handlers/main.yml is:

```auto
- name: restart_and_enable_httpd
  service:
    name: httpd
    state: restarted
    enabled: true

```

```auto

```

```auto
This is Ansible 2.6 on RHEL 6. httpd is installed earlier in the process but at the end it is not running nor is it turned on per checkconfig. 

```

```auto

```

```auto
What am I missing, besides a brain, a clue, and a life?

```

```auto

```

```auto
Thanks!

```

```auto

```

```auto
Leam

```

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [October 18, 2018, 3:37pm UTC](https://forum.ansible.com/t/handlers-called-but-not-working/28819/2 "2018-10-18T15:37:31Z")

</div>

> In the ansible output it says:
> 
> &nbsp;&nbsp;META: ran handlers

This indicates that it run all the handler that was notified so that mean not necessarily all the handlers.

> For this role handlers/main.yml is:
> 
> - name: restart\_and\_enable\_httpd  
> &nbsp;&nbsp;service:  
> &nbsp;&nbsp;&nbsp;&nbsp;name: httpd  
> &nbsp;&nbsp;&nbsp;&nbsp;state: restarted  
> &nbsp;&nbsp;&nbsp;&nbsp;enabled: true
> 
> This is Ansible 2.6 on RHEL 6. httpd is installed earlier in the process but at the end it is not running nor is it turned on per checkconfig.

Did you add a notify on this install task?

---

<div class="post-metadata">

**Author:** ![LeamHall](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/leamhall/32/9390_2.png) [@LeamHall](https://forum.ansible.com/u/LeamHall)\
**Post date:** [October 18, 2018, 3:47pm UTC](https://forum.ansible.com/t/handlers-called-but-not-working/28819/3 "2018-10-18T15:47:02Z")

</div>

> > In the ansible output it says:
> > 
> > META: ran handlers
> 
> This indicates that it run all the handler that was notified so that mean not necessarily all the handlers.

Ah, good to know! There are 4 places where the handler is called, which was another question.

> > For this role handlers/main.yml is:
> > 
> > - name: restart\_and\_enable\_httpd  
> > service:  
> > name: httpd  
> > state: restarted  
> > enabled: true
> > 
> > This is Ansible 2.6 on RHEL 6. httpd is installed earlier in the process but at the end it is not running nor is it turned on per checkconfig.
> 
> Did you add a notify on this install task?

Yes, with the note that I actually fixed the handler names to match.

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [October 18, 2018, 3:56pm UTC](https://forum.ansible.com/t/handlers-called-but-not-working/28819/4 "2018-10-18T15:56:04Z")

</div>

include has only ok and failed status and not changed.  
It's the changed that trigger a notify, so you need to have the notify on the install task instead.

---

<div class="post-metadata">

**Author:** ![LeamHall](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/leamhall/32/9390_2.png) [@LeamHall](https://forum.ansible.com/u/LeamHall)\
**Post date:** [October 18, 2018, 6:11pm UTC](https://forum.ansible.com/t/handlers-called-but-not-working/28819/5 "2018-10-18T18:11:42Z")

</div>

Kai, thanks! I made the restart a playbook of it’s own since everything else could be optioned out at some point in time.

Leam
