ansible / ansible.windows / 2.3.0 / module / win_service_info Gather information about Windows services Authors: Jordan Borean (@jborean93)ansible.windows.win_service_info (2.3.0) — module
Install with ansible-galaxy collection install ansible.windows:==2.3.0
collections: - name: ansible.windows version: 2.3.0
Gather information about all or a specific installed Windows service(s).
- 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*
name: description: - If specified, this is used to match the C(name) or C(display_name) of the Windows service to get the info for. - Can be a wildcard to match multiple services but the wildcard will only be matched on the C(name) of the service and not C(display_name). - If omitted then all services will returned. type: str
exists: description: Whether any services were found based on the criteria specified. returned: always sample: true type: bool services: contains: checkpoint: description: - A check-point value that the service increments periodically to report its progress. sample: 0 type: int controls_accepted: description: - A list of controls that the service can accept. - Common controls are C(stop), C(pause_continue), C(shutdown). elements: str sample: - stop - shutdown type: list dependencies: description: - A list of services by their C(name) that this service is dependent on. elements: str sample: - HTTP - RPCSS type: list dependency_of: description: - A list of services by their C(name) that depend on this service. elements: str sample: - upnphost - WMPNetworkSvc type: list description: description: - The description of the service. sample: Example description of the Windows service. type: str desktop_interact: description: - Whether the service can interact with the desktop, only valid for services running as C(SYSTEM). sample: false type: bool display_name: description: - The display name to be used by SCM to identify the service. sample: Windows Remote Management (WS-Management) type: str error_control: description: - The action to take if a service fails to start. - Common values are C(critical), C(ignore), C(normal), C(severe). sample: normal type: str failure_action_on_non_crash_failure: description: - Controls when failure actions are fired based on how the service was stopped. sample: false type: bool failure_actions: contains: delay_ms: description: - The time to wait, in milliseconds, before performing the specified action. sample: 120000 type: int type: description: - The action that will be performed. - Common values are C(none), C(reboot), C(restart), C(run_command). sample: run_command type: str description: - A list of failure actions to run in the event of a failure. elements: dict type: list failure_command: description: - The command line that will be run when a C(run_command) failure action is fired. sample: runme.exe type: str failure_reboot_msg: description: - The message to be broadcast to server users before rebooting when a C(reboot) failure action is fired. sample: Service failed, rebooting host. type: str failure_reset_period_sec: description: - The time, in seconds, after which to reset the failure count to zero. sample: 86400 type: int launch_protection: description: - The protection type of the service. - Common values are C(none), C(windows), C(windows_light), or C(antimalware_light). sample: none type: str load_order_group: description: - 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 type: str name: description: - The name of the service. sample: WinRM type: str path: description: - 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 type: str pre_shutdown_timeout_ms: description: - The preshutdown timeout out value in milliseconds. sample: 10000 type: int preferred_node: description: - The node number for the preferred node. - This will be C(null) if the Windows host has no NUMA configuration. sample: 0 type: int process_id: description: - The process identifier of the running service. sample: 5135 type: int required_privileges: description: - A list of privileges that the service requires and will run with elements: str sample: - SeBackupPrivilege - SeRestorePrivilege type: list service_exit_code: description: - A service-specific error code that is set while the service is starting or stopping. sample: 0 type: int service_flags: description: - Shows more information about the behaviour of a running service. - Currently the only flag that can be set is C(runs_in_system_process). elements: str sample: - runs_in_system_process type: list service_type: description: - The type of service. - Common types are C(win32_own_process), C(win32_share_process), C(user_own_process), C(user_share_process), C(kernel_driver). sample: win32_own_process type: str sid_info: description: - The behavior of how the service's access token is generated and how to add the service SID to the token. - Common values are C(none), C(restricted), or C(unrestricted). sample: none type: str start_mode: description: - When the service is set to start. - Common values are C(auto), C(manual), C(disabled), C(delayed). sample: auto type: str state: description: - The current running state of the service. - Common values are C(stopped), C(start_pending), C(stop_pending), C(started), C(continue_pending), C(pause_pending), C(paused). sample: started type: str triggers: contains: action: description: - The action to perform once triggered, can be C(start_service) or C(stop_service). sample: start_service type: str data_items: contains: data: description: - The trigger data item value. - Can be a string, list of string, int, or base64 string of binary data. sample: named pipe type: complex type: description: - The type of C(data) for the trigger. - Common values are C(string), C(binary), C(level), C(keyword_any), or C(keyword_all). sample: string type: str description: - A list of trigger data items that contain trigger specific data. - A trigger can contain 0 or multiple data items. elements: dict type: list sub_type: description: - The trigger event sub type that is specific to each C(type). - Common values are C(named_pipe_event), C(domain_join), C(domain_leave), C(firewall_port_open), and others. sample: null type: str sub_type_guid: description: - The guid which represents the trigger sub type. sample: 1ce20aba-9851-4421-9430-1ddeb766e809 type: str type: description: - The trigger event type. - Common values are C(custom), C(rpc_interface_event), C(domain_join), C(group_policy), and others. sample: domain_join type: str description: - A list of triggers defined for the service. elements: dict type: list username: description: - The username used to run the service. - Can be null for user services and certain driver services. sample: NT AUTHORITY\SYSTEM type: str wait_hint_ms: description: - The estimated time in milliseconds required for a pending start, stop, pause,or continue operations. sample: 0 type: int win32_exitcode: description: - The error code returned from the service binary once it has stopped. - When set to C(1066) then a service specific error is returned on C(service_exit_code). sample: 0 type: int description: - A list of service(s) that were found based on the criteria. - Will be an empty list if no services were found. elements: dict returned: always type: list