diff --git a/bin/ansible-connection b/bin/ansible-connection index d2d10e71c28..31fd0ac0f70 100755 --- a/bin/ansible-connection +++ b/bin/ansible-connection @@ -295,7 +295,7 @@ def main(): sys.exit("FAIL: %s" % e) ssh = connection_loader.get('ssh', class_only=True) - cp = ssh._create_control_path(pc.remote_addr, pc.port, pc.remote_user) + cp = ssh._create_control_path(pc.remote_addr, pc.port, pc.remote_user, pc.connection) # create the persistent connection dir if need be and create the paths # which we will be using later diff --git a/lib/ansible/plugins/connection/ssh.py b/lib/ansible/plugins/connection/ssh.py index 85669ff4ce6..94e820b073e 100644 --- a/lib/ansible/plugins/connection/ssh.py +++ b/lib/ansible/plugins/connection/ssh.py @@ -268,9 +268,11 @@ class Connection(ConnectionBase): sock.close() @staticmethod - def _create_control_path(host, port, user): + def _create_control_path(host, port, user, connection=None): '''Make a hash for the controlpath based on con attributes''' pstring = '%s-%s-%s' % (host, port, user) + if connection: + pstring += '-%s' % connection m = hashlib.sha1() m.update(to_bytes(pstring)) digest = m.hexdigest()