summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbhijit Menon-Sen <ams@2ndQuadrant.com>2015-10-02 13:13:49 +0530
committerAbhijit Menon-Sen <ams@2ndQuadrant.com>2015-10-02 21:26:25 +0530
commit96c4dc273a3f5bc70f2111ce063b2a750825a5a6 (patch)
tree6eedfd33fc6905796b3fa40c506471385b19372b
parent1981bf2b950053e05110fed7d87f7d5f42c1a700 (diff)
downloadansible-96c4dc273a3f5bc70f2111ce063b2a750825a5a6.tar.gz
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.
-rw-r--r--lib/ansible/constants.py2
-rw-r--r--lib/ansible/plugins/connection/ssh.py9
2 files changed, 2 insertions, 9 deletions
diff --git a/lib/ansible/constants.py b/lib/ansible/constants.py
index 8ebc4d5742..3d985d0f3d 100644
--- a/lib/ansible/constants.py
+++ b/lib/ansible/constants.py
@@ -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)
# 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_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)
diff --git a/lib/ansible/plugins/connection/ssh.py b/lib/ansible/plugins/connection/ssh.py
index 85eb22bbcd..10e96ae039 100644
--- a/lib/ansible/plugins/connection/ssh.py
+++ b/lib/ansible/plugins/connection/ssh.py
@@ -150,18 +150,11 @@ class Connection(ConnectionBase):
# Older versions of ssh (e.g. in RHEL 6) don't accept sftp -q.
self._command += ['-q']
- # Next, we add [ssh_connection]ssh_args from ansible.cfg, or the default
- # Control* settings.
+ # Next, we add [ssh_connection]ssh_args from ansible.cfg.
if self._play_context.ssh_args:
args = self._split_args(self._play_context.ssh_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
# (e.g. host_key_checking) or inventory variables (ansible_ssh_port) or