Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow for ssh-specific arguments #6238

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/ansible/constants.py
Expand Up @@ -152,6 +152,7 @@ def shell_expand_path(path):

# CONNECTION RELATED
ANSIBLE_SSH_ARGS = get_config(p, 'ssh_connection', 'ssh_args', 'ANSIBLE_SSH_ARGS', None)
ANSIBLE_SSH_SPECIFIC_ARGS = get_config(p, 'ssh_connection', 'ssh_specific_args', 'ANSIBLE_SSH_SPECIFIC_ARGS', None)
ANSIBLE_SSH_CONTROL_PATH = get_config(p, 'ssh_connection', 'control_path', 'ANSIBLE_SSH_CONTROL_PATH', "%(directory)s/ansible-ssh-%%h-%%p-%%r")
ANSIBLE_SSH_PIPELINING = get_config(p, 'ssh_connection', 'pipelining', 'ANSIBLE_SSH_PIPELINING', False, boolean=True)
PARAMIKO_RECORD_HOST_KEYS = get_config(p, 'paramiko_connection', 'record_host_keys', 'ANSIBLE_PARAMIKO_RECORD_HOST_KEYS', True, boolean=True)
Expand Down
6 changes: 6 additions & 0 deletions lib/ansible/runner/connection_plugins/ssh.py
Expand Up @@ -65,6 +65,10 @@ def connect(self):
"-o", "ControlPersist=60s",
"-o", "ControlPath=%s" % (C.ANSIBLE_SSH_CONTROL_PATH % dict(directory=self.cp_dir))]

self.ssh_specific_args = []
if C.ANSIBLE_SSH_SPECIFIC_ARGS:
self.ssh_specific_args += shlex.split(C.ANSIBLE_SSH_SPECIFIC_ARGS)

cp_in_use = False
cp_path_set = False
for arg in self.common_args:
Expand Down Expand Up @@ -165,6 +169,8 @@ def exec_command(self, cmd, tmp_path, sudo_user=None, sudoable=False, executable
ssh_cmd += ["-q"]
ssh_cmd += self.common_args

ssh_cmd += self.ssh_specific_args

if self.ipv6:
ssh_cmd += ['-6']
ssh_cmd += [self.host]
Expand Down