Skip to content
Permalink
Browse files

ansible: add mitogen_ssh_compression variable.

  • Loading branch information
dw committed Jan 31, 2019
1 parent 2c7af9f commit eaa990a97c0d3c30f82192bc9ca8ae2713732a4f
Showing with 26 additions and 0 deletions.
  1. +10 −0 ansible_mitogen/connection.py
  2. +12 −0 ansible_mitogen/transport_config.py
  3. +4 −0 docs/ansible.rst
@@ -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 @@ def mitogen_ssh_debug_level(self):
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 @@ def mitogen_machinectl_path(self):
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 @@ def mitogen_machinectl_path(self):
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

0 comments on commit eaa990a

Please sign in to comment.