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.
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
- Unique to this instance of the playbook run ?
- Accessible to the module’s underlying python script ?
- 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