ansible-test is for collections (and ansible-core), so if you don’t have one, you cannot use it.
I would really suggest to move your plugin into a collection (you can have a local collection foo.bar
local to your playbooks in a collections/ansible_collections/foo/bar
subdirectory, you don’t need to keep it in a separate repository or even build and publish it).
That’s because you are not using ansible-core’s Python module (as in: Python module, not Ansible module) loader, which doesn’t need the __init__.py
files to be present, but you’re (implicitly) using the plain Python module loader. I guess for older versions that one was added magically when using the plugin loader, but now it isn’t.
You should probably run init_plugin_loader()
from ansible.plugins.loader
before using the loader, that seems to initialize everything:
from ansible.plugins.loader import lookup_loader, init_plugin_loader
init_plugin_loader()
dig_module = lookup_loader.get("community.general.dig")