win_nssm – Install a service using NSSM¶
Synopsis¶
Install a Windows service using the NSSM wrapper.
NSSM is a service helper which doesn’t suck. See https://nssm.cc/ for more information.
Requirements¶
The below requirements are needed on the host that executes this module.
nssm >= 2.24.0 # (install via win_chocolatey)
win_chocolatey: name=nssm
Parameters¶
Notes¶
Note
The service will NOT be started after its creation when
state=present
.Once the service is created, you can use the win_service module to start it or configure some additionals properties, such as its startup type, dependencies, service account, and so on.
See Also¶
See also
- win_service – Manage and query Windows services
The official documentation on the win_service module.
Examples¶
- name: Install the foo service
win_nssm:
name: foo
application: C:\windows\foo.exe
# This will yield the following command: C:\windows\foo.exe bar "true"
- name: Install the Consul service with a list of parameters
win_nssm:
name: Consul
application: C:\consul\consul.exe
arguments:
- agent
- -config-dir=C:\consul\config
# This is strictly equivalent to the previous example
- name: Install the Consul service with an arbitrary string of parameters
win_nssm:
name: Consul
application: C:\consul\consul.exe
arguments: agent -config-dir=C:\consul\config
# Install the foo service, and then configure and start it with win_service
- name: Install the foo service, redirecting stdout and stderr to the same file
win_nssm:
name: foo
application: C:\windows\foo.exe
stdout_file: C:\windows\foo.log
stderr_file: C:\windows\foo.log
- name: Configure and start the foo service using win_service
win_service:
name: foo
dependencies: [ adf, tcpip ]
user: foouser
password: secret
start_mode: manual
state: started
- name: Remove the foo service
win_nssm:
name: foo
state: absent
Status¶
This module is not guaranteed to have a backwards compatible interface. [preview]
This module is maintained by the Ansible Community. [community]
Authors¶
Adam Keech (@smadam813)
George Frank (@georgefrank)
Hans-Joachim Kliemeck (@h0nIg)
Michael Wild (@themiwi)
Kevin Subileau (@ksubileau)
Hint
If you notice any issues in this documentation, you can edit this document to improve it.