�
�Udac @` s� d d l m Z m Z m Z e Z i d d 6d g d 6d d 6Z d Z d Z d
Z d d l
m Z y d d l Z e
Z Wn e k
r� e Z n Xd
� Z d � Z e d k r� e � n d S( i ( t absolute_importt divisiont print_functions 1.1t metadata_versiont previewt statust communityt supported_bys�
module: pids
version_added: 2.8
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."
short_description: "Retrieves process IDs list if the process is running otherwise return empty list"
author:
- Saranya Sridharan (@saranyasridharan)
requirements:
- psutil(python module)
options:
name:
description: the name of the process you want to get PID for.
required: true
type: str
s�
# 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(',')}}"
s�
pids:
description: Process IDs of the given process
returned: list of none, one, or more process IDs
type: list
sample: [100,200]
( t
AnsibleModuleNc C` sm g t j d d d g � D]P } | j r | j j d d � r | j d j � | j � k r | j d ^ q S( Nt attrst pidt name( t psutilt process_itert infot gett Nonet lower( R t p( ( s? /usr/lib/python2.7/site-packages/ansible/modules/system/pids.pyt get_pid7 s c C` sy t d t d t d t d d � � d t � } t sF | j d d � n | j d } t d t | � � } | j | � d S(
Nt
argument_specR t requiredt typet strt supports_check_modet msgsS Missing required 'psutil' python module. Try installing it with: pip install psutilt pids( R t dictt Truet
HAS_PSUTILt fail_jsont paramsR t exit_json( t moduleR t response( ( s? /usr/lib/python2.7/site-packages/ansible/modules/system/pids.pyt main; s
t __main__( t
__future__R R R R t
__metaclass__t ANSIBLE_METADATAt
DOCUMENTATIONt EXAMPLESt RETURNt ansible.module_utils.basicR R R R t ImportErrort FalseR R# t __name__( ( ( s? /usr/lib/python2.7/site-packages/ansible/modules/system/pids.pyt <module> s"