summaryrefslogtreecommitdiff
path: root/lib/ansible/plugins/connection/ssh.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ansible/plugins/connection/ssh.py')
-rw-r--r--lib/ansible/plugins/connection/ssh.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/ansible/plugins/connection/ssh.py b/lib/ansible/plugins/connection/ssh.py
index ee0c1f67a0..fbbdef1d05 100644
--- a/lib/ansible/plugins/connection/ssh.py
+++ b/lib/ansible/plugins/connection/ssh.py
@@ -72,6 +72,12 @@ def _ssh_retry(func):
remaining_tries = int(C.ANSIBLE_SSH_RETRIES) + 1
cmd_summary = "%s..." % args[0]
for attempt in range(remaining_tries):
+ cmd = args[0]
+ if attempt != 0 and self._play_context.password and isinstance(cmd, list):
+ # If this is a retry, the fd/pipe for sshpass is closed, and we need a new one
+ self.sshpass_pipe = os.pipe()
+ cmd[1] = b'-d' + to_bytes(self.sshpass_pipe[0], nonstring='simplerepr', errors='surrogate_or_strict')
+
try:
try:
return_tuple = func(self, *args, **kwargs)