ansible: add mitogen_ssh_compression variable.

pull/564/head
David Wilson 5 years ago
parent d6c4a983e1
commit b499fbe29b

@ -70,6 +70,15 @@ def optional_int(value):
return None
def default(value, default):
"""
Return `default` is `value` is :data:`None`, otherwise return `value`.
"""
if value is None:
return default
return value
def _connect_local(spec):
"""
Return ContextService arguments for a local connection.
@ -103,6 +112,7 @@ def _connect_ssh(spec):
'check_host_keys': check_host_keys,
'hostname': spec.remote_addr(),
'username': spec.remote_user(),
'compression': default(spec.mitogen_ssh_compression(), True),
'password': spec.password(),
'port': spec.port(),
'python_path': spec.python_path(),

@ -273,6 +273,12 @@ class Spec(with_metaclass(abc.ABCMeta, object)):
The SSH debug level.
"""
@abc.abstractmethod
def mitogen_ssh_compression(self):
"""
Whether SSH compression is enabled.
"""
@abc.abstractmethod
def extra_args(self):
"""
@ -398,6 +404,9 @@ class PlayContextSpec(Spec):
def mitogen_ssh_debug_level(self):
return self._connection.get_task_var('mitogen_ssh_debug_level')
def mitogen_ssh_compression(self):
return self._connection.get_task_var('mitogen_ssh_compression')
def extra_args(self):
return self._connection.get_extra_args()
@ -577,5 +586,8 @@ class MitogenViaSpec(Spec):
def mitogen_ssh_debug_level(self):
return self._host_vars.get('mitogen_ssh_debug_level')
def mitogen_ssh_compression(self):
return self._host_vars.get('mitogen_ssh_compression')
def extra_args(self):
return [] # TODO

@ -901,6 +901,10 @@ except connection delegation is supported.
* ``ssh_args``, ``ssh_common_args``, ``ssh_extra_args``
* ``mitogen_ssh_debug_level``: integer between `0..3` indicating the SSH client
debug level. Ansible must also be run with '-vvv' to view the output.
* ``mitogen_ssh_compression``: :data:`True` to enable SSH compression,
otherwise :data:`False`. This will change to off by default in a future
release. If you are targetting many hosts on a fast network, please consider
disabling SSH compression.
Debugging

Loading…
Cancel
Save