Custom Connection Plugin - to instatiate any generic "connection"

Hello - I spend a fair bit of time researching and the answer eludes me. Hoping that it is a simple mis-conception of mine that someone will correct.

I currently have a custom module to make REST API calls to a bunch of devices, it uses the “local” connection plugin. The custom module creates a connection everytime it needs to make a call. I was thinking maybe I could create a custom connection plugin - where I connect one time and then use that in the custom module. Besides the performance improvement - I am looking to simplify the playbook. Right not it has connection information in every single call. So if I need to change something it is a bit of a mess - yes I parameterized the values, but adding a new connection setting means changing every single task!

So I looked at the docker connector, the uri module to try and see how it is being done. For what I can gather, poring over the code, ConnectionBase class assumes that you want to do some variant of a ssh connection with copying files and executing on a remote server.

I am thinking of simply creating a dumb connector that does nothing but store the connections details I can use from my custom module. But then I cannot figure out how the module can query the connector being used for the necessary information.

Appreciate any help. Maybe my research was not sufficient - in which case please provide a link that I can read up or direct me to the source code that can help clarify my thinking.

Many thanks!

Ayya

Nothing exists yet, but I have this proposal https://github.com/ansible/proposals/issues/24 that would do ‘just that’

Thank you so much for replying! Glad I am not missing something significant. Really look forward to getting this kind of support - I mean your proposed auth_plugins.

It will be really nice if you can also consider the following:

  1. Avoid the overhead of invoking a connection_plugins - albeit local in my case.
  2. An alternative way to collect device “facts” as part of the authentication call.

I see this also useful for managing things like LDAP or RDBMS schema. One could do a LDAP connection and run various tasks regardless of the underlying OS hosting the LDAP server (or the LDAP vendor).

How does one support or vote for such a feature please?

Best,
Ayya