win_nssm - Implement additional parameters (#65131)
* win_nssm - Implement additional parameters * Update win_nssm.py * Snake case change * Update win_nssm.py * Update win_nssm.ps1 * Remove duplicated executable option * Added default values for new options
This commit is contained in:
parent
2acfa0e08c
commit
d8982b4992
3 changed files with 65 additions and 2 deletions
|
@ -0,0 +1,2 @@
|
|||
minor_changes:
|
||||
- "win_nssm - Implement additional parameters - (https://github.com/ansible/ansible/issues/62620)"
|
|
@ -38,6 +38,11 @@ $stderrFile = Get-AnsibleParam -obj $params -name "stderr_file" -type "path"
|
|||
|
||||
$executable = Get-AnsibleParam -obj $params -name "executable" -type "path" -default "nssm.exe"
|
||||
|
||||
$app_rotate_bytes = Get-AnsibleParam -obj $params -name "app_rotate_bytes" -type "int" -default 104858
|
||||
$app_rotate_online = Get-AnsibleParam -obj $params -name "app_rotate_online" -type "int" -default 0 -validateset 0,1
|
||||
$app_stop_method_console = Get-AnsibleParam -obj $params -name "app_stop_method_console" -type "int"
|
||||
$app_stop_method_skip = Get-AnsibleParam -obj $params -name "app_stop_method_skip" -type "int" -validateset 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
|
||||
|
||||
# Deprecated options since 2.8. Remove in 2.12
|
||||
$startMode = Get-AnsibleParam -obj $params -name "start_mode" -type "str" -default "auto" -validateset $start_modes_map.Keys -resultobj $result
|
||||
$dependencies = Get-AnsibleParam -obj $params -name "dependencies" -type "list"
|
||||
|
@ -439,14 +444,14 @@ if ($state -eq 'absent') {
|
|||
Update-NssmServiceParameter -parameter "AppRotateFiles" -value 1 @common_params
|
||||
|
||||
#don't rotate until the service restarts
|
||||
Update-NssmServiceParameter -parameter "AppRotateOnline" -value 0 @common_params
|
||||
Update-NssmServiceParameter -parameter "AppRotateOnline" -value $app_rotate_online @common_params
|
||||
|
||||
#both of the below conditions must be met before rotation will happen
|
||||
#minimum age before rotating
|
||||
Update-NssmServiceParameter -parameter "AppRotateSeconds" -value 86400 @common_params
|
||||
|
||||
#minimum size before rotating
|
||||
Update-NssmServiceParameter -parameter "AppRotateBytes" -value 104858 @common_params
|
||||
Update-NssmServiceParameter -parameter "AppRotateBytes" -value $app_rotate_bytes @common_params
|
||||
|
||||
|
||||
############## DEPRECATED block since 2.8. Remove in 2.12 ##############
|
||||
|
@ -471,6 +476,16 @@ if ($state -eq 'absent') {
|
|||
}
|
||||
########################################################################
|
||||
|
||||
# Added per users` requests
|
||||
if ($null -ne $app_stop_method_console)
|
||||
{
|
||||
Update-NssmServiceParameter -parameter "AppStopMethodConsole" -value $app_stop_method_console @common_params
|
||||
}
|
||||
|
||||
if ($null -ne $app_stop_method_skip)
|
||||
{
|
||||
Update-NssmServiceParameter -parameter "AppStopMethodSkip" -value $app_stop_method_skip @common_params
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -110,6 +110,51 @@ options:
|
|||
type: str
|
||||
choices: [ auto, delayed, disabled, manual ]
|
||||
default: auto
|
||||
app_rotate_bytes:
|
||||
description:
|
||||
- NSSM will not rotate any file which is smaller than the configured number of bytes.
|
||||
type: int
|
||||
default: 104858
|
||||
version_added: "2.10"
|
||||
app_rotate_online:
|
||||
description:
|
||||
- If set to 1, nssm can rotate files which grow to the configured file size limit while the service is running.
|
||||
type: int
|
||||
choices:
|
||||
- 0
|
||||
- 1
|
||||
default: 0
|
||||
version_added: "2.10"
|
||||
app_stop_method_console:
|
||||
description:
|
||||
- Time to wait after sending Control-C.
|
||||
type: int
|
||||
version_added: "2.10"
|
||||
app_stop_method_skip:
|
||||
description:
|
||||
- To disable service shutdown methods, set to the sum of one or more of the numbers
|
||||
- 1 - Don't send Control-C to the console.
|
||||
- 2 - Don't send WM_CLOSE to windows.
|
||||
- 4 - Don't send WM_QUIT to threads.
|
||||
- 8 - Don't call TerminateProcess().
|
||||
type: int
|
||||
choices:
|
||||
- 1
|
||||
- 2
|
||||
- 3
|
||||
- 4
|
||||
- 5
|
||||
- 6
|
||||
- 7
|
||||
- 8
|
||||
- 9
|
||||
- 10
|
||||
- 11
|
||||
- 12
|
||||
- 13
|
||||
- 14
|
||||
- 15
|
||||
version_added: "2.10"
|
||||
seealso:
|
||||
- module: win_service
|
||||
notes:
|
||||
|
@ -122,6 +167,7 @@ author:
|
|||
- Hans-Joachim Kliemeck (@h0nIg)
|
||||
- Michael Wild (@themiwi)
|
||||
- Kevin Subileau (@ksubileau)
|
||||
- Shachaf Goldstein (@Shachaf92)
|
||||
'''
|
||||
|
||||
EXAMPLES = r'''
|
||||
|
|
Loading…
Reference in a new issue