ansible.windows.win_service_info – Gather information about Windows services
ansible.windows.win_service_info – Gather information about Windows services
Note
This plugin is part of the ansible.windows collection (version 1.3.0).
To install it use: ansible-galaxy collection install ansible.windows
.
To use it in a playbook, specify: ansible.windows.win_service_info
.
Synopsis
- Gather information about all or a specific installed Windows service(s).
Parameters
Parameter | Choices/Defaults | Comments |
---|---|---|
name string |
If specified, this is used to match the Can be a wildcard to match multiple services but the wildcard will only be matched on the If omitted then all services will returned. |
See Also
See also
- ansible.windows.win_service
- The official documentation on the ansible.windows.win_service module.
Examples
- name: Get info for all installed services
ansible.windows.win_service_info:
register: service_info
- name: Get info for a single service
ansible.windows.win_service_info:
name: WinRM
register: service_info
- name: Get info for a service using its display name
ansible.windows.win_service_info:
name: Windows Remote Management (WS-Management)
- name: Find all services that start with 'win'
ansible.windows.win_service_info:
name: win*
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description | |||
---|---|---|---|---|---|
exists boolean |
always |
Whether any services were found based on the criteria specified.
Sample: True | |||
services list / elements=dictionary |
always |
A list of service(s) that were found based on the criteria. Will be an empty list if no services were found.
| |||
checkpoint integer |
success |
A check-point value that the service increments periodically to report its progress.
| |||
controls_accepted list / elements=string |
success |
A list of controls that the service can accept. Common controls are
Sample: ['stop', 'shutdown'] | |||
dependencies list / elements=string |
success |
A list of services by their
Sample: ['HTTP', 'RPCSS'] | |||
dependency_of list / elements=string |
success |
A list of services by their
Sample: ['upnphost', 'WMPNetworkSvc'] | |||
description string |
success |
The description of the service.
Sample: Example description of the Windows service. | |||
desktop_interact boolean |
success |
Whether the service can interact with the desktop, only valid for services running as
| |||
display_name string |
success |
The display name to be used by SCM to identify the service.
Sample: Windows Remote Management (WS-Management) | |||
error_control string |
success |
The action to take if a service fails to start. Common values are
Sample: normal | |||
failure_action_on_non_crash_failure boolean |
success |
Controls when failure actions are fired based on how the service was stopped.
| |||
failure_actions list / elements=dictionary |
success |
A list of failure actions to run in the event of a failure.
| |||
delay_ms integer |
success |
The time to wait, in milliseconds, before performing the specified action.
Sample: 120000 | |||
type string |
success |
The action that will be performed. Common values are
Sample: run_command | |||
failure_command string |
success |
The command line that will be run when a
Sample: runme.exe | |||
failure_reboot_msg string |
success |
The message to be broadcast to server users before rebooting when a
Sample: Service failed, rebooting host. | |||
failure_reset_period_sec integer |
success |
The time, in seconds, after which to reset the failure count to zero.
Sample: 86400 | |||
launch_protection string |
success |
The protection type of the service. Common values are
Sample: none | |||
load_order_group string |
success |
The name of the load ordering group to which the service belongs. Will be an empty string if it does not belong to any group.
Sample: My group | |||
name string |
success |
The name of the service.
Sample: WinRM | |||
path string |
success |
The path to the service binary and any arguments used when starting the service. The binary part can be quoted to ensure any spaces in path are not treated as arguments.
Sample: C:\Windows\System32\svchost.exe -k netsvcs -p | |||
pre_shutdown_timeout_ms integer |
success |
The preshutdown timeout out value in milliseconds.
Sample: 10000 | |||
preferred_node integer |
success |
The node number for the preferred node. This will be
| |||
process_id integer |
success |
The process identifier of the running service.
Sample: 5135 | |||
required_privileges list / elements=string |
success |
A list of privileges that the service requires and will run with
Sample: ['SeBackupPrivilege', 'SeRestorePrivilege'] | |||
service_exit_code integer |
success |
A service-specific error code that is set while the service is starting or stopping.
| |||
service_flags list / elements=string |
success |
Shows more information about the behaviour of a running service. Currently the only flag that can be set is
Sample: ['runs_in_system_process'] | |||
service_type string |
success |
The type of service. Common types are
Sample: win32_own_process | |||
sid_info string |
success |
The behavior of how the service's access token is generated and how to add the service SID to the token. Common values are
Sample: none | |||
start_mode string |
success |
When the service is set to start. Common values are
Sample: auto | |||
state string |
success |
The current running state of the service. Common values are
Sample: started | |||
triggers list / elements=dictionary |
success |
A list of triggers defined for the service.
| |||
action string |
success |
The action to perform once triggered, can be
Sample: start_service | |||
data_items list / elements=dictionary |
success |
A list of trigger data items that contain trigger specific data. A trigger can contain 0 or multiple data items.
| |||
data complex |
success |
The trigger data item value. Can be a string, list of string, int, or base64 string of binary data.
Sample: named pipe | |||
type string |
success |
The type of Common values are
Sample: string | |||
sub_type string |
success |
The trigger event sub type that is specific to each Common values are
| |||
sub_type_guid string |
success |
The guid which represents the trigger sub type.
Sample: 1ce20aba-9851-4421-9430-1ddeb766e809 | |||
type string |
success |
The trigger event type. Common values are
Sample: domain_join | |||
username string |
success |
The username used to run the service. Can be null for user services and certain driver services.
Sample: NT AUTHORITY\SYSTEM | |||
wait_hint_ms integer |
success |
The estimated time in milliseconds required for a pending start, stop, pause,or continue operations.
| |||
win32_exitcode integer |
success |
The error code returned from the service binary once it has stopped. When set to
|
Authors
- Jordan Borean (@jborean93)
© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.11/collections/ansible/windows/win_service_info_module.html