community.windows.win_listen_ports_facts module – Recopilates the facts of the listening ports of the machine
This module is part of the community.windows collection (version 2.1.0).
You might already have this collection installed if you are using the
It is not included in
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:
New in community.windows 1.10.0
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.
The format of the date when the process that owns the port started.
The date specification is UFormat
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.
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
Gather facts on processes listening on TCP and UDP ports.
- name: Recopilate ports facts
- name: Retrieve only ports with Closing and Established states
- name: Get ports facts with only the year within the date field
Common return values are documented here, the following are the fields unique to this module:
List of dicts with the detected TCP ports
List of dicts with the detected UDP ports