On 06/08/2021 09:02, Dhiwakar Ravikumar wrote:
I'm trying to create an external file that every single task (Python modules 
for which I've implemented) in the playbook should read from and write into 
some information.

I wanted to use the process ID for the playbook itself but I'm not sure how to 
fetch this information from within the module itself i.e. the python script 
itself.

$PPID keeps changing as evidenced by the following playbook.


Untitled.png


  the value for the PPID was

"stdout": "2850132"
"stdout": "2850343"

the 1st and 2nd times respectively. Is there any value like a process ID or 
something similar that is

 1. Unique to this instance of the playbook run ?
 2. Accessible to the module's underlying python script ?
 3. Without involving use of psutil or any package that doesn't come as part of 
Python 3.X


For a better reading experience, check out
https://stackoverflow.com/questions/68677124/getting-a-id-value-unique-to-an-instance-of-an-ansible-playbook

That's sound like an awkward and fragile approach to me. Why would you use the 
process ID as unique value?
An UUID (see to_uuid filter) would be definitely unique.

Regards
       Racke




--
You received this message because you are subscribed to the Google Groups "Ansible 
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to 
[email protected] 
<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/1ae9e985-25b5-40dd-857e-6dc62ea99705n%40googlegroups.com
 
<https://groups.google.com/d/msgid/ansible-project/1ae9e985-25b5-40dd-857e-6dc62ea99705n%40googlegroups.com?utm_medium=email&utm_source=footer>.


--
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration.

--
You received this message because you are subscribed to the Google Groups "Ansible 
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/48387bec-f9d0-d935-1f2a-b9e7401c7dbe%40linuxia.de.

Reply via email to