win_nssm – Install a service using NSSM¶
Install a Windows service using the NSSM wrapper.
NSSM is a service helper which doesn’t suck. See https://nssm.cc/ for more information.
The below requirements are needed on the host that executes this module.
nssm >= 2.24.0 # (install via win_chocolatey)
The service will NOT be started after its creation when
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.
- win_service – Manage and query Windows services
The official documentation on the win_service module.
- 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