diff --git a/test/test_backends.py b/test/test_backends.py index fd1d5437..07dc4475 100644 --- a/test/test_backends.py +++ b/test/test_backends.py @@ -283,6 +283,15 @@ def get_vars(host): "user": None, }, ), + ( + {}, + b"host ansible_connection=community.docker.docker", + { + "NAME": "docker", + "name": "host", + "user": None, + }, + ), ( {}, b"host ansible_connection=docker ansible_become=yes ansible_become_user=u ansible_user=z ansible_host=container", diff --git a/testinfra/utils/ansible_runner.py b/testinfra/utils/ansible_runner.py index 8a650970..3cbd7bf9 100644 --- a/testinfra/utils/ansible_runner.py +++ b/testinfra/utils/ansible_runner.py @@ -68,12 +68,14 @@ def get_ansible_host(config, inventory, host, ssh_config=None, ssh_identity_file "paramiko_ssh", "local", "docker", + "community.docker.docker", "lxc", "lxd", ): # unhandled connection type, must use force_ansible=True return None connection = { + "community.docker.docker": "docker", "lxd": "lxc", "paramiko_ssh": "paramiko", "smart": "ssh",