ansible.windows.win_service_info module – Gather information about Windows services
Note
This module is part of the ansible.windows collection (version 2.5.0).
You might already have this collection installed if you are using the ansible
package. It is not included in ansible-core
. To check whether it is installed, run ansible-galaxy collection list
.
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 | 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
-
Manage and query Windows services.
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 | Description |
---|---|
exists boolean | Whether any services were found based on the criteria specified. Returned: always Sample: |
services list / elements=dictionary | A list of service(s) that were found based on the criteria. Will be an empty list if no services were found. Returned: always |
checkpoint integer |
A check-point value that the service increments periodically to report its progress. Returned: success Sample: |
controls_accepted list / elements=string |
A list of controls that the service can accept. Common controls are Returned: success Sample: |
dependencies list / elements=string |
A list of services by their Returned: success Sample: |
dependency_of list / elements=string |
A list of services by their Returned: success Sample: |
description string |
The description of the service. Returned: success Sample: |
desktop_interact boolean |
Whether the service can interact with the desktop, only valid for services running as Returned: success Sample: |
display_name string |
The display name to be used by SCM to identify the service. Returned: success Sample: |
error_control string |
The action to take if a service fails to start. Common values are Returned: success Sample: |
failure_action_on_non_crash_failure boolean |
Controls when failure actions are fired based on how the service was stopped. Returned: success Sample: |
failure_actions list / elements=dictionary |
A list of failure actions to run in the event of a failure. Returned: success |
delay_ms integer |
The time to wait, in milliseconds, before performing the specified action. Returned: success Sample: |
type string |
The action that will be performed. Common values are Returned: success Sample: |
failure_command string |
The command line that will be run when a Returned: success Sample: |
failure_reboot_msg string |
The message to be broadcast to server users before rebooting when a Returned: success Sample: |
failure_reset_period_sec integer |
The time, in seconds, after which to reset the failure count to zero. Returned: success Sample: |
launch_protection string |
The protection type of the service. Common values are Returned: success Sample: |
load_order_group string |
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. Returned: success Sample: |
name string |
The name of the service. Returned: success Sample: |
path string |
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. Returned: success Sample: |
pre_shutdown_timeout_ms integer |
The preshutdown timeout out value in milliseconds. Returned: success Sample: |
preferred_node integer |
The node number for the preferred node. This will be Returned: success Sample: |
process_id integer |
The process identifier of the running service. Returned: success Sample: |
required_privileges list / elements=string |
A list of privileges that the service requires and will run with Returned: success Sample: |
service_exit_code integer |
A service-specific error code that is set while the service is starting or stopping. Returned: success Sample: |
service_flags list / elements=string |
Shows more information about the behaviour of a running service. Currently the only flag that can be set is Returned: success Sample: |
service_type string |
The type of service. Common types are Returned: success Sample: |
sid_info string |
The behavior of how the service’s access token is generated and how to add the service SID to the token. Common values are Returned: success Sample: |
start_mode string |
When the service is set to start. Common values are Returned: success Sample: |
state string |
The current running state of the service. Common values are Returned: success Sample: |
triggers list / elements=dictionary |
A list of triggers defined for the service. Returned: success |
action string |
The action to perform once triggered, can be Returned: success Sample: |
data_items list / elements=dictionary |
A list of trigger data items that contain trigger specific data. A trigger can contain 0 or multiple data items. Returned: success |
data complex |
The trigger data item value. Can be a string, list of string, int, or base64 string of binary data. Returned: success Sample: |
type string |
The type of Common values are Returned: success Sample: |
sub_type string |
The trigger event sub type that is specific to each Common values are Returned: success |
sub_type_guid string |
The guid which represents the trigger sub type. Returned: success Sample: |
type string |
The trigger event type. Common values are Returned: success Sample: |
username string |
The username used to run the service. Can be null for user services and certain driver services. Returned: success Sample: |
wait_hint_ms integer |
The estimated time in milliseconds required for a pending start, stop, pause,or continue operations. Returned: success Sample: |
win32_exitcode integer |
The error code returned from the service binary once it has stopped. When set to Returned: success Sample: |
Collection links
© 2012–2018 Michael DeHaan
© 2018–2024 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/ansible/windows/win_service_info_module.html