win_nssm: Clean up parameter handling + docs (#21625)

This commit is contained in:
Dag Wieers 2017-02-24 08:14:12 +01:00 committed by Matt Davis
parent 58cbf1bfe0
commit ff1efb2c1c
2 changed files with 105 additions and 116 deletions

View file

@ -31,7 +31,7 @@ module: win_nssm
version_added: "2.0"
short_description: NSSM - the Non-Sucking Service Manager
description:
- nssm is a service helper which doesn't suck. See https://nssm.cc/ for more information.
- nssm is a service helper which doesn't suck. See U(https://nssm.cc/) for more information.
requirements:
- "nssm >= 2.24.0 # (install via win_chocolatey) win_chocolatey: name=nssm"
options:
@ -43,7 +43,6 @@ options:
description:
- State of the service on the system
- Note that NSSM actions like "pause", "continue", "rotate" do not fit the declarative style of ansible, so these should be implemented via the ansible command module
required: false
choices:
- present
- started
@ -57,47 +56,34 @@ options:
- "Specify this whenever the service may need to be installed (state: present, started, stopped, restarted)"
- "Note that the application name must look like the following, if the directory includes spaces:"
- 'nssm install service "c:\\Program Files\\app.exe\\" "C:\\Path with spaces\\"'
- "See commit 0b386fc1984ab74ee59b7bed14b7e8f57212c22b in the nssm.git project for more info (https://git.nssm.cc/?p=nssm.git;a=commit;h=0b386fc1984ab74ee59b7bed14b7e8f57212c22b)"
required: false
default: null
- "See commit 0b386fc1984ab74ee59b7bed14b7e8f57212c22b in the nssm.git project for more info: U(https://git.nssm.cc/?p=nssm.git;a=commit;h=0b386fc1984ab74ee59b7bed14b7e8f57212c22b)"
stdout_file:
description:
- Path to receive output
required: false
default: null
stderr_file:
description:
- Path to receive error output
required: false
default: null
app_parameters:
description:
- Parameters to be passed to the application when it starts
required: false
default: null
- Parameters to be passed to the application when it starts.
- Use either this or C(app_parameters_free_form), not both
app_parameters_free_form:
version_added: "2.3.0"
description:
- Single string of parameters to be passed to the service. Use either this or 'app_parameters', not both
- Single string of parameters to be passed to the service.
- Use either this or C(app_parameters), not both
dependencies:
description:
- Service dependencies that has to be started to trigger startup, separated by comma.
required: false
default: null
user:
description:
- User to be used for service startup
required: false
default: null
password:
description:
- Password to be used for service startup
required: false
default: null
start_mode:
description:
- If C(auto) is selected, the service will start at bootup. 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.
required: true
default: auto
choices:
- auto
@ -121,7 +107,7 @@ EXAMPLES = r'''
name: foo
application: C:\windows\foo.exe
app_parameters:
bar: true
bar: true
# Install and start the foo service with a key-value pair argument, where the argument needs to start with a dash
# This will yield the following command: C:\windows\\foo.exe -bar "true"
@ -129,7 +115,7 @@ EXAMPLES = r'''
name: foo
application: C:\windows\foo.exe
app_parameters:
"-bar": true
"-bar": true
# Install and start the foo service with a single parameter
# This will yield the following command: C:\windows\\foo.exe bar
@ -137,7 +123,7 @@ EXAMPLES = r'''
name: foo
application: C:\windows\foo.exe
app_parameters:
_: bar
_: bar
# Install and start the foo service with a mix of single params, and key value pairs
# This will yield the following command: C:\windows\\foo.exe bar -file output.bat
@ -145,18 +131,18 @@ EXAMPLES = r'''
name: foo
application: C:\windows\foo.exe
app_parameters:
_: bar
"-file": "output.bat"
_: bar
"-file": "output.bat"
# Use the single line parameters option to specify an arbitrary string of parameters
# for the service executable
- name: Make sure the Consul service runs
win_nssm:
name: consul
application: "C:\\consul\\consul.exe"
app_parameters_free_form: "agent -config-dir=C:\\consul\\config"
stdout_file: "C:\\consul\\log.txt"
stderr_file: "C:\\consul\\error.txt"
name: consul
application: C:\consul\consul.exe
app_parameters_free_form: agent -config-dir=C:\consul\config
stdout_file: C:\consul\log.txt
stderr_file: C:\consul\error.txt
# Install and start the foo service, redirecting stdout and stderr to the same file
- win_nssm: