Thank you Brian, I was exploring different strategies and this whole PID 
thing i.e. reliance on PID as a constant value failed miserably, I am 
trying to implement a strategy where every single module that's running is 
capable of identifying which instance of a playbook called it. One option 
was to always pass an argument to a collection of modules that I'm 
developing, something like Module Group defaults 
https://docs.ansible.com/ansible/latest/user_guide/playbooks_module_defaults.html

Is there a way I can implement module group defaults for the collection of 
modules that I'm developing ?
For instance, the following snippet doesn't really work since my collection 
of modules isn't recognized as a "group"
module_defaults: 
  group/dhiwakar_namespace.dhiwakar_collection: 
        session: 123


On Friday, August 6, 2021 at 9:49:52 PM UTC+5:30 Brian Coca wrote:

> You have several, but my previous response should give you the pid of
> the `ansible-playbook` invocation you are currently running.
>
> As for the 'several' pids, the ansible-playbook CLI forks for each
> task/host (another pid) which then will execute on the remote (yet
> another pid) .. which normally involves a fork of the daemon granting
> access (ssh?) .. yet another pid. The task itself might fork again
> (async, run a cli , etc) .. with more pids involved. So you have to be
> very specific about which pid you want and in most cases requires
> changing action plugin/module code to deliver them.
>
>
> -- 
> ----------
> Brian Coca
>
>

-- 
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/24a6f7b9-b27a-45c8-a0bc-0b903cf5ef5cn%40googlegroups.com.

Reply via email to