ansible / ansible.builtin / v2.9.27 / module / win_nssm Install a service using NSSM | "added in version" 2.0 of ansible.builtin" Authors: Adam Keech (@smadam813), George Frank (@georgefrank), Hans-Joachim Kliemeck (@h0nIg), Michael Wild (@themiwi), Kevin Subileau (@ksubileau) preview | supported by communityansible.builtin.win_nssm (v2.9.27) — module
pip
Install with pip install ansible==2.9.27
Install a Windows service using the NSSM wrapper.
NSSM is a service helper which doesn't suck. See U(https://nssm.cc/) for more information.
- 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
name: description: - Name of the service to operate on. required: true type: str user: description: - User to be used for service startup. - DEPRECATED since v2.8, please use the M(win_service) module instead. type: str state: choices: - absent - present - started - stopped - restarted default: present description: - State of the service on the system. - Values C(started), C(stopped), and C(restarted) are deprecated since v2.8, please use the M(win_service) module instead to start, stop or restart the service. type: str password: description: - Password to be used for service startup. - DEPRECATED since v2.8, please use the M(win_service) module instead. type: str arguments: aliases: - app_parameters_free_form description: - Parameters to be passed to the application when it starts. - This can be either a simple string or a list. - This parameter was renamed from I(app_parameters_free_form) in 2.8. - This is mutually exclusive with I(app_parameters). type: str version_added: '2.3' version_added_collection: ansible.builtin executable: default: nssm.exe description: - The location of the NSSM utility (in case it is not located in your PATH). type: path version_added: 2.8.0 version_added_collection: ansible.builtin start_mode: choices: - auto - delayed - disabled - manual default: auto description: - If C(auto) is selected, the service will start at bootup. - C(delayed) causes a delayed but automatic start after boot (added in version 2.5). - C(manual) means that the service will start only when another service needs it. - C(disabled) means that the service will stay off, regardless if it is needed or not. - DEPRECATED since v2.8, please use the M(win_service) module instead. type: str application: description: - The application binary to run as a service - Required when I(state) is C(present), C(started), C(stopped), or C(restarted). type: path description: description: - The description to set for the service. type: str version_added: 2.8.0 version_added_collection: ansible.builtin stderr_file: description: - Path to receive error output. type: path stdout_file: description: - Path to receive output. type: path dependencies: description: - Service dependencies that has to be started to trigger startup, separated by comma. - DEPRECATED since v2.8, please use the M(win_service) module instead. type: list display_name: description: - The display name to set for the service. type: str version_added: 2.8.0 version_added_collection: ansible.builtin app_parameters: description: - A string representing a dictionary of parameters to be passed to the application when it starts. - DEPRECATED since v2.8, please use I(arguments) instead. - This is mutually exclusive with I(arguments). type: str working_directory: aliases: - app_directory - chdir description: - The working directory to run the service executable from (defaults to the directory containing the application binary) type: path version_added: 2.8.0 version_added_collection: ansible.builtin