community.windows.win_listen_ports_facts module – Recopilates the facts of the listening ports of the machine
Note
This module is part of the community.windows collection (version 2.3.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 community.windows
.
To use it in a playbook, specify: community.windows.win_listen_ports_facts
.
New in community.windows 1.10.0
Synopsis
Recopilates the information of the TCP and UDP ports of the machine and the related processes.
State of the TCP ports could be filtered, as well as the format of the date when the parent process was launched.
The module’s goal is to replicate the functionality of the linux module listen_ports_facts, mantaining the format of the said module.
Parameters
Parameter |
Comments |
---|---|
The format of the date when the process that owns the port started. The date specification is UFormat Default: |
|
Filter for the state of the TCP ports that will be recopilated. Supports multiple states (Bound, Closed, CloseWait, Closing, DeleteTCB, Established, FinWait1, FinWait2, LastAck, Listen, SynReceived, SynSent and TimeWait), that can be used alone or combined. Note that the Bound state is only available on PowerShell version 4.0 or later. Default: |
Notes
Note
The generated data (tcp_listen and udp_listen) and the fields within follows the listen_ports_facts schema to achieve compatibility with the said module output, even though this module if capable of extracting ports with a state other than Listen
See Also
See also
- community.general.listen_ports_facts
Gather facts on processes listening on TCP and UDP ports.
Examples
- name: Recopilate ports facts
community.windows.win_listen_ports_facts:
- name: Retrieve only ports with Closing and Established states
community.windows.win_listen_ports_facts:
tcp_filter:
- Closing
- Established
- name: Get ports facts with only the year within the date field
community.windows.win_listen_ports_facts:
date_format: '%Y'
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
List of dicts with the detected TCP ports Returned: success Sample: |
|
List of dicts with the detected UDP ports Returned: success Sample: |