mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Add delayed start to win_nssm (#32017)
* Adds start_mode=delayed option for win_nssm It translates to Start=SERVICE_DELAYED_AUTO_START in nssm. * Adds documentation for the start_mode=delayed option of win_nssm Also, reformats the start_mode values into a list.
This commit is contained in:
parent
23a81af4f1
commit
8724c069d7
2 changed files with 8 additions and 4 deletions
|
@ -35,7 +35,7 @@ $state = Get-AnsibleParam -obj $params -name "state" -type "str" -default "prese
|
||||||
$application = Get-AnsibleParam -obj $params -name "application" -type "str"
|
$application = Get-AnsibleParam -obj $params -name "application" -type "str"
|
||||||
$appParameters = Get-AnsibleParam -obj $params -name "app_parameters" -type "str"
|
$appParameters = Get-AnsibleParam -obj $params -name "app_parameters" -type "str"
|
||||||
$appParametersFree = Get-AnsibleParam -obj $params -name "app_parameters_free_form" -type "str"
|
$appParametersFree = Get-AnsibleParam -obj $params -name "app_parameters_free_form" -type "str"
|
||||||
$startMode = Get-AnsibleParam -obj $params -name "start_mode" -type "str" -default "auto" -validateset "auto","manual","disabled" -resultobj $result
|
$startMode = Get-AnsibleParam -obj $params -name "start_mode" -type "str" -default "auto" -validateset "auto","delayed","manual","disabled" -resultobj $result
|
||||||
|
|
||||||
$stdoutFile = Get-AnsibleParam -obj $params -name "stdout_file" -type "str"
|
$stdoutFile = Get-AnsibleParam -obj $params -name "stdout_file" -type "str"
|
||||||
$stderrFile = Get-AnsibleParam -obj $params -name "stderr_file" -type "str"
|
$stderrFile = Get-AnsibleParam -obj $params -name "stderr_file" -type "str"
|
||||||
|
@ -502,7 +502,7 @@ Function Nssm-Update-StartMode
|
||||||
Throw "Error updating start mode for service ""$name"""
|
Throw "Error updating start mode for service ""$name"""
|
||||||
}
|
}
|
||||||
|
|
||||||
$modes=@{"auto" = "SERVICE_AUTO_START"; "manual" = "SERVICE_DEMAND_START"; "disabled" = "SERVICE_DISABLED"}
|
$modes=@{"auto" = "SERVICE_AUTO_START"; "delayed" = "SERVICE_DELAYED_AUTO_START"; "manual" = "SERVICE_DEMAND_START"; "disabled" = "SERVICE_DISABLED"}
|
||||||
$mappedMode = $modes.$mode
|
$mappedMode = $modes.$mode
|
||||||
if ($results -cnotlike $mappedMode) {
|
if ($results -cnotlike $mappedMode) {
|
||||||
$cmd = "set ""$name"" Start $mappedMode"
|
$cmd = "set ""$name"" Start $mappedMode"
|
||||||
|
|
|
@ -87,17 +87,21 @@ options:
|
||||||
- Password to be used for service startup
|
- Password to be used for service startup
|
||||||
start_mode:
|
start_mode:
|
||||||
description:
|
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.
|
- If C(auto) is selected, the service will start at bootup.
|
||||||
C(disabled) means that the service will stay off, regardless if it is needed or not.
|
- 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.
|
||||||
default: auto
|
default: auto
|
||||||
choices:
|
choices:
|
||||||
- auto
|
- auto
|
||||||
|
- delayed
|
||||||
- manual
|
- manual
|
||||||
- disabled
|
- disabled
|
||||||
author:
|
author:
|
||||||
- "Adam Keech (@smadam813)"
|
- "Adam Keech (@smadam813)"
|
||||||
- "George Frank (@georgefrank)"
|
- "George Frank (@georgefrank)"
|
||||||
- "Hans-Joachim Kliemeck (@h0nIg)"
|
- "Hans-Joachim Kliemeck (@h0nIg)"
|
||||||
|
- "Michael Wild (@themiwi)"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = r'''
|
EXAMPLES = r'''
|
||||||
|
|
Loading…
Reference in a new issue