# Notify with import or include not working

**URL:** <https://forum.ansible.com/t/notify-with-import-or-include-not-working/28992>\
**Category:** Ansible Project\
**Created:** [November 9, 2018, 2:26pm UTC](https://forum.ansible.com/t/notify-with-import-or-include-not-working/28992 "2018-11-09T14:26:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Claudio\_Soprano](https://avatars.discourse-cdn.com/v4/letter/c/8e7dd6/32.png) [@Claudio\_Soprano](https://forum.ansible.com/u/Claudio_Soprano)\
**Post date:** [November 9, 2018, 2:26pm UTC](https://forum.ansible.com/t/notify-with-import-or-include-not-working/28992/1 "2018-11-09T14:26:36Z")

</div>

I’m on ansible 2.6.3-1.el7 on CentOS 7.2 and i’m having problems with notify using include\_tasks or import\_tasks

This is that i want to achieve:

using a variable to pass the packages list to a task that use yum to install them

then if any packages is installed (changed state) notify two handlers (also them imported/included) passing the daemon to start/reload/restart/enable/disable/mask/unmask the daemon

So this is my playbook.yml

- hosts:  
dyn194

tasks:

# Install openafs client

- name: install openafs  
import\_tasks: /root/ansible/tasks/install\_packages.yml  
vars:  
daemon\_boot: “openafs-client”  
daemon\_reload: “openafs-client”  
daemon\_start: “openafs-client”  
packages\_to\_install:
- kernel-devel
- dkms-openafs
- openafs
- openafs-client
- openafs-docs
- openafs-krb5  
notify:
- start daemon
- enable start at boot of daemon  
tags: opens

handlers:

- import\_tasks: /root/ansible/handlers/start\_daemon.yml

- import\_tasks: /root/ansible/handlers/reload\_daemon.yml

- import\_tasks: /root/ansible/handlers/enable\_start\_at\_boot\_daemon.yml

- import\_tasks: /root/ansible/handlers/restart\_daemon.yml

this is my install\_packages.yml

# Task to install packages

- name: install packages  
yum:  
name: “{{ item }}”  
state: present  
with\_items: “{{ packages\_to\_install }}”

this is my start\_daemon.yml (handler task)

# Start daemon daemon\_start

- name: start daemon  
systemd:  
name: “{{ daemon\_start }}”  
status: started

- debug:  
msg: “daemon to start = {{ daemon\_start }}”  
listen: start daemon

this is my enable\_start\_at\_boot\_of\_daemon (handler task)

# Enable start at boot of the daemon\_boot

- name: enable start at boot of daemon  
systemd:  
name: “{{ daemon\_boot }}”  
enabled: yes

- debug:  
msg: “daemon to start at boot = {{ daemon\_boot }}”  
listen: enable start at boot of daemon

Now when i run the playbook i get

PLAY [dyn194] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

TASK [Gathering Facts] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [dyn194]

TASK [install packages] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

changed: [dyn194] =\> (item=[u’kernel-devel’, u’dkms-openafs’, u’openafs’, u’openafs-client’, u’openafs-docs’, u’openafs-krb5’])

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
dyn194 : ok=2 changed=1 unreachable=0 failed=0

the packages got installed but i don’t get the notifies to run the handlers

infact if i show the status of openafs-client i get

[root@dyn194 ~]# systemctl status openafs-client  
● openafs-client.service - OpenAFS Client Service  
Loaded: loaded (/usr/lib/systemd/system/openafs-client.service; disabled; vendor preset: disabled)  
Active: inactive (dead)

so it is not started and not enabled and in any case i got the debug messages i put in the handlers

How can i solve this ?

Thanks in advance  
Claudio

---

<div class="post-metadata">

**Author:** ![Claudio\_Soprano](https://avatars.discourse-cdn.com/v4/letter/c/8e7dd6/32.png) [@Claudio\_Soprano](https://forum.ansible.com/u/Claudio_Soprano)\
**Post date:** [November 28, 2018, 9:27am UTC](https://forum.ansible.com/t/notify-with-import-or-include-not-working/28992/2 "2018-11-28T09:27:56Z")

</div>

No hints about this problem ?

Include\_task or import\_task doesn’t notify handlers, if i include the task directly in the playbook it works, but this is not the way to reuse tasks in multiple playbooks.

So any hints or ideas are welcomed

Claudio
