win_nssm error (windows 7): Parameter "Application" is only valid for services managed by NSSM!

Hey there,

I hope that someone can shed some light on this since I’m not really a windows admin.

I have the following task:

  • name: Create service via nssm
    win_nssm:
    name: ‘{{ filebeat_service_name }}’
    application: ‘{{ filebeat_home }}\filebeat.bat’
    state: present
    notify: Restart filebeat

And I get the following error, only on windows 7 (windows 10 works fine).
Nssm was installed with the win_chocolatey module and the only difference I was was that on the win10 host it was already there and on the win7 host I got a warning that it needed to be installed first (and the module did all that by itself).

fatal: [x.x.x.x]: FAILED! => {
“changed”: false,
“msg”: “Error retrieving Application for service "filebeat"”,
“nssm_error_cmd”: “nssm.exe get filebeat Application”,
“nssm_error_log”: “Parameter "Application" is only valid for services managed by NSSM!\r\r\n”
}

Interestingly enough if I fiddle around with win_service and try and create the service, then remove it manually, it works.

Any insight is appreciated.

-Deni