mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Set explicit default for ANSIBLE_SSH_ARGS
The earlier code behaved exactly as though this default had been set, but it was actually handled as a(n unnecessary) special case inside the connection plugin, rather than set as an explicit default. If the default is overriden either in ansible.cfg or the environment, the new code will continue to work (in fact, it won't know or care, since it just uses the value set in the PlayContext). This is submitted as a separate commit for easier review to address backwards-compatibility concerns.
This commit is contained in:
parent
1981bf2b95
commit
96c4dc273a
2 changed files with 2 additions and 9 deletions
|
@ -224,7 +224,7 @@ RETRY_FILES_SAVE_PATH = get_config(p, DEFAULTS, 'retry_files_save_path'
|
||||||
DEFAULT_NULL_REPRESENTATION = get_config(p, DEFAULTS, 'null_representation', 'ANSIBLE_NULL_REPRESENTATION', None, isnone=True)
|
DEFAULT_NULL_REPRESENTATION = get_config(p, DEFAULTS, 'null_representation', 'ANSIBLE_NULL_REPRESENTATION', None, isnone=True)
|
||||||
|
|
||||||
# CONNECTION RELATED
|
# CONNECTION RELATED
|
||||||
ANSIBLE_SSH_ARGS = get_config(p, 'ssh_connection', 'ssh_args', 'ANSIBLE_SSH_ARGS', None)
|
ANSIBLE_SSH_ARGS = get_config(p, 'ssh_connection', 'ssh_args', 'ANSIBLE_SSH_ARGS', '-o ControlMaster=auto -o ControlPersist=60s')
|
||||||
ANSIBLE_SSH_CONTROL_PATH = get_config(p, 'ssh_connection', 'control_path', 'ANSIBLE_SSH_CONTROL_PATH', "%(directory)s/ansible-ssh-%%h-%%p-%%r")
|
ANSIBLE_SSH_CONTROL_PATH = get_config(p, 'ssh_connection', 'control_path', 'ANSIBLE_SSH_CONTROL_PATH', "%(directory)s/ansible-ssh-%%h-%%p-%%r")
|
||||||
ANSIBLE_SSH_PIPELINING = get_config(p, 'ssh_connection', 'pipelining', 'ANSIBLE_SSH_PIPELINING', False, boolean=True)
|
ANSIBLE_SSH_PIPELINING = get_config(p, 'ssh_connection', 'pipelining', 'ANSIBLE_SSH_PIPELINING', False, boolean=True)
|
||||||
ANSIBLE_SSH_RETRIES = get_config(p, 'ssh_connection', 'retries', 'ANSIBLE_SSH_RETRIES', 0, integer=True)
|
ANSIBLE_SSH_RETRIES = get_config(p, 'ssh_connection', 'retries', 'ANSIBLE_SSH_RETRIES', 0, integer=True)
|
||||||
|
|
|
@ -150,18 +150,11 @@ class Connection(ConnectionBase):
|
||||||
# Older versions of ssh (e.g. in RHEL 6) don't accept sftp -q.
|
# Older versions of ssh (e.g. in RHEL 6) don't accept sftp -q.
|
||||||
self._command += ['-q']
|
self._command += ['-q']
|
||||||
|
|
||||||
# Next, we add [ssh_connection]ssh_args from ansible.cfg, or the default
|
# Next, we add [ssh_connection]ssh_args from ansible.cfg.
|
||||||
# Control* settings.
|
|
||||||
|
|
||||||
if self._play_context.ssh_args:
|
if self._play_context.ssh_args:
|
||||||
args = self._split_args(self._play_context.ssh_args)
|
args = self._split_args(self._play_context.ssh_args)
|
||||||
self._add_args("ansible.cfg set ssh_args", args)
|
self._add_args("ansible.cfg set ssh_args", args)
|
||||||
else:
|
|
||||||
args = (
|
|
||||||
"-o", "ControlMaster=auto",
|
|
||||||
"-o", "ControlPersist=60s"
|
|
||||||
)
|
|
||||||
self._add_args("default arguments", args)
|
|
||||||
|
|
||||||
# Now we add various arguments controlled by configuration file settings
|
# Now we add various arguments controlled by configuration file settings
|
||||||
# (e.g. host_key_checking) or inventory variables (ansible_ssh_port) or
|
# (e.g. host_key_checking) or inventory variables (ansible_ssh_port) or
|
||||||
|
|
Loading…
Reference in a new issue