diff --git a/changelogs/fragments/78750-paramiko-ssh-args-compat.yml b/changelogs/fragments/78750-paramiko-ssh-args-compat.yml new file mode 100644 index 00000000000..6c45ba8d94f --- /dev/null +++ b/changelogs/fragments/78750-paramiko-ssh-args-compat.yml @@ -0,0 +1,3 @@ +bugfixes: +- paramiko - Add back support for ``ssh_args``, ``ssh_common_args``, and ``ssh_extra_args`` for parsing the ``ProxyCommand`` + (https://github.com/ansible/ansible/issues/78750) diff --git a/lib/ansible/plugins/connection/paramiko_ssh.py b/lib/ansible/plugins/connection/paramiko_ssh.py index 82eae5c77e4..c2b2d3dc3d4 100644 --- a/lib/ansible/plugins/connection/paramiko_ssh.py +++ b/lib/ansible/plugins/connection/paramiko_ssh.py @@ -79,6 +79,45 @@ DOCUMENTATION = """ env: [{name: ANSIBLE_PARAMIKO_PROXY_COMMAND}] ini: - {key: proxy_command, section: paramiko_connection} + ssh_args: + description: Only used in parsing ProxyCommand for use in this plugin. + default: '' + ini: + - section: 'ssh_connection' + key: 'ssh_args' + env: + - name: ANSIBLE_SSH_ARGS + vars: + - name: ansible_ssh_args + version_added: '2.7' + ssh_common_args: + description: Only used in parsing ProxyCommand for use in this plugin. + ini: + - section: 'ssh_connection' + key: 'ssh_common_args' + version_added: '2.7' + env: + - name: ANSIBLE_SSH_COMMON_ARGS + version_added: '2.7' + vars: + - name: ansible_ssh_common_args + cli: + - name: ssh_common_args + default: '' + ssh_extra_args: + description: Only used in parsing ProxyCommand for use in this plugin. + vars: + - name: ansible_ssh_extra_args + env: + - name: ANSIBLE_SSH_EXTRA_ARGS + version_added: '2.7' + ini: + - key: ssh_extra_args + section: ssh_connection + version_added: '2.7' + cli: + - name: ssh_extra_args + default: '' pty: default: True description: 'SUDO usually requires a PTY, True to give a PTY and False to not give a PTY.' @@ -267,9 +306,9 @@ class Connection(ConnectionBase): proxy_command = None # Parse ansible_ssh_common_args, specifically looking for ProxyCommand ssh_args = [ - getattr(self._play_context, 'ssh_extra_args', '') or '', - getattr(self._play_context, 'ssh_common_args', '') or '', - getattr(self._play_context, 'ssh_args', '') or '', + self.get_option('ssh_extra_args'), + self.get_option('ssh_common_args'), + self.get_option('ssh_args', ''), ] args = self._split_ssh_args(' '.join(ssh_args)) @@ -287,7 +326,7 @@ class Connection(ConnectionBase): if proxy_command: break - proxy_command = proxy_command or self.get_option('proxy_command') + proxy_command = self.get_option('proxy_command') or proxy_command sock_kwarg = {} if proxy_command: