|
|
|
@ -111,8 +111,7 @@ DOCUMENTATION = """
|
|
|
|
|
proxy_command:
|
|
|
|
|
default: ''
|
|
|
|
|
description:
|
|
|
|
|
- Proxy information for running the connection via a jumphost
|
|
|
|
|
- Also this plugin will scan 'ssh_args', 'ssh_extra_args' and 'ssh_common_args' from the 'ssh' plugin settings for proxy information if set.
|
|
|
|
|
- Proxy information for running the connection via a jumphost.
|
|
|
|
|
type: string
|
|
|
|
|
env: [{name: ANSIBLE_PARAMIKO_PROXY_COMMAND}]
|
|
|
|
|
ini:
|
|
|
|
@ -120,60 +119,6 @@ DOCUMENTATION = """
|
|
|
|
|
vars:
|
|
|
|
|
- name: ansible_paramiko_proxy_command
|
|
|
|
|
version_added: '2.15'
|
|
|
|
|
ssh_args:
|
|
|
|
|
description: Only used in parsing ProxyCommand for use in this plugin.
|
|
|
|
|
default: ''
|
|
|
|
|
type: string
|
|
|
|
|
ini:
|
|
|
|
|
- section: 'ssh_connection'
|
|
|
|
|
key: 'ssh_args'
|
|
|
|
|
env:
|
|
|
|
|
- name: ANSIBLE_SSH_ARGS
|
|
|
|
|
vars:
|
|
|
|
|
- name: ansible_ssh_args
|
|
|
|
|
version_added: '2.7'
|
|
|
|
|
deprecated:
|
|
|
|
|
why: In favor of the "proxy_command" option.
|
|
|
|
|
version: "2.18"
|
|
|
|
|
alternatives: proxy_command
|
|
|
|
|
ssh_common_args:
|
|
|
|
|
description: Only used in parsing ProxyCommand for use in this plugin.
|
|
|
|
|
type: string
|
|
|
|
|
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: ''
|
|
|
|
|
deprecated:
|
|
|
|
|
why: In favor of the "proxy_command" option.
|
|
|
|
|
version: "2.18"
|
|
|
|
|
alternatives: proxy_command
|
|
|
|
|
ssh_extra_args:
|
|
|
|
|
description: Only used in parsing ProxyCommand for use in this plugin.
|
|
|
|
|
type: string
|
|
|
|
|
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: ''
|
|
|
|
|
deprecated:
|
|
|
|
|
why: In favor of the "proxy_command" option.
|
|
|
|
|
version: "2.18"
|
|
|
|
|
alternatives: proxy_command
|
|
|
|
|
pty:
|
|
|
|
|
default: True
|
|
|
|
|
description: 'SUDO usually requires a PTY, True to give a PTY and False to not give a PTY.'
|
|
|
|
@ -399,30 +344,7 @@ class Connection(ConnectionBase):
|
|
|
|
|
self._log_channel = name
|
|
|
|
|
|
|
|
|
|
def _parse_proxy_command(self, port: int = 22) -> dict[str, t.Any]:
|
|
|
|
|
proxy_command = None
|
|
|
|
|
# Parse ansible_ssh_common_args, specifically looking for ProxyCommand
|
|
|
|
|
ssh_args = [
|
|
|
|
|
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))
|
|
|
|
|
for i, arg in enumerate(args):
|
|
|
|
|
if arg.lower() == 'proxycommand':
|
|
|
|
|
# _split_ssh_args split ProxyCommand from the command itself
|
|
|
|
|
proxy_command = args[i + 1]
|
|
|
|
|
else:
|
|
|
|
|
# ProxyCommand and the command itself are a single string
|
|
|
|
|
match = SETTINGS_REGEX.match(arg)
|
|
|
|
|
if match:
|
|
|
|
|
if match.group(1).lower() == 'proxycommand':
|
|
|
|
|
proxy_command = match.group(2)
|
|
|
|
|
|
|
|
|
|
if proxy_command:
|
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
proxy_command = self.get_option('proxy_command') or proxy_command
|
|
|
|
|
proxy_command = self.get_option('proxy_command') or None
|
|
|
|
|
|
|
|
|
|
sock_kwarg = {}
|
|
|
|
|
if proxy_command:
|
|
|
|
|