Custom module to get list of open linux ports and running services

Hi All,

Is there a custom module/role already present to get list fo open ports and linux running services?
If not, then I have to use command module. How do i parse the returned netstat output and conevert to a JSON document.

Thanks,
Akash

Akash,

There is a service_facts module that shipped in Ansible 2.5 that will list services. To get the open ports on a system, it would be much easier to write a custom facts module and parse the data rather than trying to parse the command output it in the playbook. You can use the run_command method to get the output, then parse it in Python, and return the results in a dictionary via the exit_json method.