I am developing some ansible action plugins to interact with host-related settings (a monitoring API, not currently supported in ansible modules).
As I move from a single module to multiple modules, it's clear to me that some functionality needs to be shared, for example, the authorization dance needed, or unwrapping requests.
Some functionality is API specific and can go into a pip-installable python module to wrap access to the API.
Some other functionality is very ansible specific. The API needs a chunk of header session/token data since the site will deny access if you keep requesting a token and don't use the current unexpired one - so this should be stored in a well-known place in the ansible facts, such that all the plugins related would access it from the same place.
Simply putting an adjacent python file and importing it into the action plugin code won't work - I think there is some magic going on with how action plugins end up being loaded by ansible when used in roles or playbooks.
So other than pushing the ansible specific part of this back into the API wrapper python library, is there any way I keep code in a collection to share with multiple action plugins?