# Win\_Service not working in handler?

**URL:** <https://forum.ansible.com/t/win-service-not-working-in-handler/24786>\
**Category:** Ansible Project\
**Created:** [June 21, 2017, 2:35pm UTC](https://forum.ansible.com/t/win-service-not-working-in-handler/24786 "2017-06-21T14:35:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Onallion](https://avatars.discourse-cdn.com/v4/letter/o/9e8a1a/32.png) [@Onallion](https://forum.ansible.com/u/Onallion)\
**Post date:** [June 21, 2017, 2:35pm UTC](https://forum.ansible.com/t/win-service-not-working-in-handler/24786/1 "2017-06-21T14:35:05Z")

</div>

Hi,

I am running a playbook with a task that calls a handler like so:  
`

- name: “Configure zabbix-agent”  
win\_template:  
src: zabbix\_agentd.conf.j2  
dest: C:\Program Files\Zabbix Agent\zabbix\_agentd.conf  
newline\_sequence: ‘\n’  
trim\_blocks: no  
notify: restart zabbix-agent  
`

The handler itself is:

`

- name: restart zabbix-agent  
win\_service:  
name: Zabbix Agent  
state: restarted  
start\_mode: auto  
`

When I run the playbook there are no errors, but when it reaches the end there is no mention of the handler and it doesn’t run.

The funny thing is, when I use the Linux equivalent and run it on a Linux host, it does work:

`

- name: restart zabbix-agent  
service: name={{ zabbix\_agent\_service }}  
state=restarted  
enabled=yes  
become: yes

`

I could just set it as a task, but I don’t want the playbook to restart the service every time it runs, just when something changed.  
Any help appreciated

---

<div class="post-metadata">

**Author:** ![David\_Baumann](https://avatars.discourse-cdn.com/v4/letter/d/aca169/32.png) [@David\_Baumann](https://forum.ansible.com/u/David_Baumann)\
**Post date:** [June 21, 2017, 4:03pm UTC](https://forum.ansible.com/t/win-service-not-working-in-handler/24786/2 "2017-06-21T16:03:09Z")

</div>

is “Configure zabbix-agent” reporting a change ?

---

<div class="post-metadata">

**Author:** ![j.r.hawkesworth](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@j.r.hawkesworth](https://forum.ansible.com/u/j.r.hawkesworth)\
**Post date:** [June 26, 2017, 5:24am UTC](https://forum.ansible.com/t/win-service-not-working-in-handler/24786/3 "2017-06-26T05:24:58Z")

</div>

Is zabbix\_agentd.conf being updated.

Since you have spaces in the dest, I think you _might_ need to quote the dest like this

`dest: 'C:\Program Files\Zabbix Agent\zabbix_agentd.conf'`

`( Use single quotes - ' ' not double quotes " " - if you use double quotes you have to have double backslashes like this:`

`dest: "C:\\Program Files\\Zabbix Agent\\zabbix_agentd.conf"`

`Hope this helps,`

`Jon`
