File tree 3 files changed +26
-0
lines changed
3 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -70,6 +70,15 @@ def optional_int(value):
70
70
return None
71
71
72
72
73
+ def default (value , default ):
74
+ """
75
+ Return `default` is `value` is :data:`None`, otherwise return `value`.
76
+ """
77
+ if value is None :
78
+ return default
79
+ return value
80
+
81
+
73
82
def _connect_local (spec ):
74
83
"""
75
84
Return ContextService arguments for a local connection.
@@ -103,6 +112,7 @@ def _connect_ssh(spec):
103
112
'check_host_keys' : check_host_keys ,
104
113
'hostname' : spec .remote_addr (),
105
114
'username' : spec .remote_user (),
115
+ 'compression' : default (spec .mitogen_ssh_compression (), True ),
106
116
'password' : spec .password (),
107
117
'port' : spec .port (),
108
118
'python_path' : spec .python_path (),
Original file line number Diff line number Diff line change @@ -273,6 +273,12 @@ def mitogen_ssh_debug_level(self):
273
273
The SSH debug level.
274
274
"""
275
275
276
+ @abc .abstractmethod
277
+ def mitogen_ssh_compression (self ):
278
+ """
279
+ Whether SSH compression is enabled.
280
+ """
281
+
276
282
@abc .abstractmethod
277
283
def extra_args (self ):
278
284
"""
@@ -398,6 +404,9 @@ def mitogen_machinectl_path(self):
398
404
def mitogen_ssh_debug_level (self ):
399
405
return self ._connection .get_task_var ('mitogen_ssh_debug_level' )
400
406
407
+ def mitogen_ssh_compression (self ):
408
+ return self ._connection .get_task_var ('mitogen_ssh_compression' )
409
+
401
410
def extra_args (self ):
402
411
return self ._connection .get_extra_args ()
403
412
@@ -577,5 +586,8 @@ def mitogen_machinectl_path(self):
577
586
def mitogen_ssh_debug_level (self ):
578
587
return self ._host_vars .get ('mitogen_ssh_debug_level' )
579
588
589
+ def mitogen_ssh_compression (self ):
590
+ return self ._host_vars .get ('mitogen_ssh_compression' )
591
+
580
592
def extra_args (self ):
581
593
return [] # TODO
Original file line number Diff line number Diff line change @@ -901,6 +901,10 @@ except connection delegation is supported.
901
901
* ``ssh_args ``, ``ssh_common_args ``, ``ssh_extra_args ``
902
902
* ``mitogen_ssh_debug_level ``: integer between `0..3 ` indicating the SSH client
903
903
debug level. Ansible must also be run with '-vvv' to view the output.
904
+ * ``mitogen_ssh_compression ``: :data: `True ` to enable SSH compression,
905
+ otherwise :data: `False `. This will change to off by default in a future
906
+ release. If you are targetting many hosts on a fast network, please consider
907
+ disabling SSH compression.
904
908
905
909
906
910
Debugging
You can’t perform that action at this time.
0 commit comments