Share data between lookup plugin instances

Hi all,

I’ve written a lookup plugin that authenticates to some REST endpoint.
Once authenticated a token is returned that can be reused for further REST calls.

Is there a way I can store the token someplace, so that the next invocation
of the lookup plugin can access it and use it instead of authenticating with userid/pw
again ?

I tried to access the ‘play’ object to get its VariableManager, but I guess that’s
not accessible from a LookupPlugin. Then I tried to use pythons’ os.environ
to set a variable, but apparently each invocation of the lookup is done using
a different python instance, hence not sharing their environments.

Thanks for any help.

Pieter.

There is no facility to do this, you would have to save/read a file
like the password lookup does.
Another option is to have a task that does the login and registers the
token into a variable (via register: or returning ansible_facts).

FYI, each lookup does not have it's own python instance, but each
task/host has it's own fork.

OK, thanks Brian !