community.general
community.general copied to clipboard
listen_ports_facts extension
Summary
Hey we are currently using the modul listen_ports_facts:
- name: Gather facts on listening ports
listen_ports_facts:
- name: List TCP ports
debug:
msg: "{{ ansible_facts.tcp_listen }}"
Which gives us for tcp following output:
[{
"address": "::",
"name": "sshd",
"pid": 937,
"port": 22,
"protocol": "tcp",
"stime": "Thu Jun 2 09:49:16 2022",
"user": "root"
}, ...]
It would be cool to include more infos from netstat or ss. Mainly state, local_address and foreign_address something like:
[{
"local_address": "0.0.0.0", <----
"foreign_address": "0.0.0.0" <----
"pid": "1152",
"port": "52583",
"state": "Bound", <----
"protocol": "tcp",
"stime": "Thu Jun 2 09:49:16 2022",
"user": "root"
"process": "AzureADConnectAuthenticationAgentService", <----
"service": "AzureADConnectAuthenticationAgent", <----
}, ...]
Finally finding process and service would also be a nice bonus (not in the netstat scope).
Hope this is understandable. Greetings
Issue Type
Feature Idea
Component Name
plugins/modules/system/listen_ports_facts.py
Additional Information
No response
Code of Conduct
- [X] I agree to follow the Ansible Code of Conduct
Files identified in the description:
If these files are incorrect, please update the component name
section of the description or use the !component
bot command.
cc @russoz click here for bot help
Files identified in the description:
If these files are incorrect, please update the component name
section of the description or use the !component
bot command.
cc @ndavison click here for bot help
Hey together, any option for me to get some feedback on the idea?
@PKehnel this module seems not to be actively maintained, so there won't be much feedback unless someone interested in this module takes a look at this.
CC @moonrail and @gaetan-craft who recently worked on this module, and thus might be interested in this.
The code is already done for ss, it's just adding them to the return, job has to be done for netstat. I unfortunately have no time to work on it right now
Files identified in the description:
If these files are incorrect, please update the component name
section of the description or use the !component
bot command.