# win\_nssm task shows 'changed' for every run

**URL:** <https://forum.ansible.com/t/win-nssm-task-shows-changed-for-every-run/20443>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [February 3, 2016, 6:11pm UTC](https://forum.ansible.com/t/win-nssm-task-shows-changed-for-every-run/20443 "2016-02-03T18:11:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joe\_Levis](https://avatars.discourse-cdn.com/v4/letter/j/b9e5f3/32.png) [@Joe\_Levis](https://forum.ansible.com/u/Joe_Levis)\
**Post date:** [February 3, 2016, 6:11pm UTC](https://forum.ansible.com/t/win-nssm-task-shows-changed-for-every-run/20443/1 "2016-02-03T18:11:44Z")

</div>

Ubuntu 14.04, Ansible 2.0.0.2

I’m using win\_nssm to install a service. It’s successfully installing the service, however all subsequent runs show the win\_nssm task as ‘changed’.

Why is win\_nssm showing ‘changed’ even though the service has already been installed and nothing has been modified? Is it actually re-installing the service?

**Playbook:**

win\_nssm:

name: servicename

state: present

application: C:\path\to\exe

start\_mode: manual

user: \*\*\*\*\*\*\*\*

password: \*\*\*\*\*\*\*\*

**Output:**

TASK [appservice : Install appservice via NSSM] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

changed: [[server1.my.domain.com](http://server1.my.domain.com)]

Any way to condition around this?

---

<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:** [February 8, 2016, 2:47pm UTC](https://forum.ansible.com/t/win-nssm-task-shows-changed-for-every-run/20443/2 "2016-02-08T14:47:32Z")

</div>

I’ve not looked at the code, but perhaps it is a bug. Since you seem to be able to reproduce, I suggest raising it in ansible modules extra project (using the issue template) [https://github.com/ansible/ansible/raw/devel/ISSUE\_TEMPLATE.md](https://github.com/ansible/ansible/raw/devel/ISSUE_TEMPLATE.md)

You might be able to work around using changed\_when - see [http://docs.ansible.com/ansible/playbooks\_error\_handling.html#controlling-what-defines-failure](http://docs.ansible.com/ansible/playbooks_error_handling.html#controlling-what-defines-failure)

To do so, you might need to check if the service exists already, which you can do something like this (untested)

- name: check if service exists  
raw: “Get-Service -Name ‘appservice’”

register: appservice\_status  
ignore\_errors: True

Then you’d have to check the stdout stored in the registered appservice\_status var to see if it exists.

You could perhaps even use a when: clause so the win\_nssm only runs when the service doesn’t exist, although that wouldn’t ever let you reconfigure the service in the same playbook (which may or may not be important to you).

Hope this helps,

Jon

---

<div class="post-metadata">

**Author:** ![Joe\_Levis](https://avatars.discourse-cdn.com/v4/letter/j/b9e5f3/32.png) [@Joe\_Levis](https://forum.ansible.com/u/Joe_Levis)\
**Post date:** [February 8, 2016, 3:51pm UTC](https://forum.ansible.com/t/win-nssm-task-shows-changed-for-every-run/20443/3 "2016-02-08T15:51:31Z")

</div>

Thanks Jon. I’ll see what I can do with these options.

-Joe
