ansible/ansible — pull request #397 by phred (2012-05-15 18:44:40+00:00)
Title: Make sudo handle incorrect passwords better

Ansible would stall waiting for the command output which would never
come when the sudo password was wrong. The simple solution here was
to have ansible execute a simple 'echo' command and look for its
output BEFORE attempting to run any other sudo commands. Given the
difficulty with detecting a successful sudo (since sudo exec's the
command and doesn't provide any other status indicator) and the
messiness of detecting the 'Sorry, try again' prompt (would need
to stuff bytes back into the stream if the output isn't 'Sorry',
kind of a mess), using a simple echo command seems the best solution.