ansible stuck when gathering fatcs.

52 views
Skip to first unread message

yuyu...@bytedance.com

unread,
Jun 3, 2015, 5:04:08 AM6/3/15
to ansible...@googlegroups.com
I resolved this problem by add timeout in runner/connection_plugins/ssh.py, such as:

157         import time
158         start = time.time()
159         TIMEOUT = self.runner.timeout*2
160         while True:
161             rfd, wfd, efd = select.select(rpipes, [], rpipes, 1)
162
163             # fail early if the sudo/su password is wrong
164             if self.runner.sudo and sudoable:
165                 if self.runner.sudo_pass:
166                     incorrect_password = gettext.dgettext(
167                         "sudo", "Sorry, try again.")
168                     if stdout.endswith("%s\r\n%s" % (incorrect_password,
169                                                      prompt)):
170                         raise errors.AnsibleError('Incorrect sudo password')
171
172                 if stdout.endswith(prompt):
173                     raise errors.AnsibleError('Missing sudo password')
174
175             if self.runner.su and su and self.runner.su_pass:
176                 incorrect_password = gettext.dgettext(
177                     "su", "Sorry")
178                 if stdout.endswith("%s\r\n%s" % (incorrect_password, prompt)):
179                     raise errors.AnsibleError('Incorrect su password')
180
181             end = time.time()
182             if TIMEOUT <= (end - start):
183                 raise errors.AnsibleError('Read ssh stdin timeout')

Is there any way to resolve that?

Thank you.

Brian Coca

unread,
Jun 3, 2015, 1:01:32 PM6/3/15
to ansible...@googlegroups.com
facts themselves have a timeout around them, but it is on the target
side, IIRC we also have a connection timeout but that might be a bit
longer.

In any case, try with latest devel, there have been many changes to
the connections and this might have been 'fixed'.

--
Brian Coca

yuyu...@bytedance.com

unread,
Jun 4, 2015, 3:56:53 AM6/4/15
to ansible...@googlegroups.com

Ok, thank you.
Reply all
Reply to author
Forward
0 new messages