community.general.pids (0.2.1) — module

Retrieves process IDs list if the process is running otherwise return empty list

Authors: Saranya Sridharan (@saranyasridharan)

Install collection

Install with ansible-galaxy collection install community.general:==0.2.1


Add to requirements.yml

  collections:
    - name: community.general
      version: 0.2.1

Description

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.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Pass the process name
- name: Getting process IDs of the process
  pids:
      name: python
  register: pids_of_python
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Printing the process IDs obtained
  debug:
    msg: "PIDS of python:{{pids_of_python.pids|join(',')}}"

Inputs

    
name:
    description: the name of the process you want to get PID for.
    required: true
    type: str

Outputs

pids:
  description: Process IDs of the given process
  returned: list of none, one, or more process IDs
  sample:
  - 100
  - 200
  type: list