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

You might be able to work around using changed_when - 
see 
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


On Wednesday, 3 February 2016 18:11:45 UTC, Joe Levis wrote:
>
> 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]
>
>
>
> Any way to condition around this?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/535af3b3-d09a-401c-ab1a-82370ea4ef7d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to