community / community.general / 0.2.1 / module / pids Retrieves process IDs list if the process is running otherwise return empty list Authors: Saranya Sridharan (@saranyasridharan)community.general.pids (0.2.1) — module
Install with ansible-galaxy collection install community.general:==0.2.1
collections: - name: community.general version: 0.2.1
Retrieves a list of PIDs of given process name in Ansible controller/controlled machines.Returns an empty list if no process in that name exists.
# Pass the process name - name: Getting process IDs of the process pids: name: python register: pids_of_python
- name: Printing the process IDs obtained debug: msg: "PIDS of python:{{pids_of_python.pids|join(',')}}"
name: description: the name of the process you want to get PID for. required: true type: str
pids: description: Process IDs of the given process returned: list of none, one, or more process IDs sample: - 100 - 200 type: list