The lsof command produces information about all files opened by processes on UNIX systems. Everything is represented as a file, so this command generates useful output for troubleshooting. One of the many use cases for Ansible is ticket augmentation - in other words, adding context to issues that arise in an environment to reduce the mean-time-to-remediation. If an application is experiencing issues, the lsof command can offer insights into potential causes by identifying all files related to the process in question. In this post, I'll introduce a filter plugin that structures the output of lsof to be used in downstream Ansible tasks.
Autodotes Blog Post:
https://autodotes.com/posts/jRhz2KtGBiJNX2a73erI
Source Code:
https://github.com/zjleblanc/zjleblanc.utils/blob/master/plugins/filter/lsof_parse.py