community.general/lib/ansible
jkleint e69e078569 More robust remote sudo.
The basic idea is sudo /bin/sh -c 'quoted_command'.  We use Paramiko's low-level API to set a timeout, get a pseudo tty, execute sudo and the (shell quoted) command atomically, wait just until sudo is ready to accept the password before sending it down the pipe, and then return the command's stdout and stderr.

This should be faster, as there are no unneeded sleeps.  There are no permissions issues reading the output.  It will raise socket.timeout if the command takes too long.  However, this is a per-read timeout, not a total execution timeout, so as long as the command is writing output and you are reading it, it will not time out.

Local and non-sudo commands remain unchanged, but should probably adopt a similar approach.

Since this is a significant change, it needs a lot of testing.  Also, someone smarter than I should double-check the quoting and execution, since it is a security issue.
2012-04-23 17:32:08 -03:00
..
__init__.py Bump release to 0.0.2 2012-04-03 09:51:05 -04:00
callbacks.py Warn if no hosts matched 2012-04-11 21:05:46 -04:00
connection.py More robust remote sudo. 2012-04-23 17:32:08 -03:00
constants.py Add support for specifying sudo passwords to both ansible & playbook. Nopasswd sudo is no longer required. 2012-04-13 19:06:11 -04:00
errors.py Update example to use correct service state; minor pep8 indent/spacing fixes 2012-03-15 23:10:03 -04:00
inventory.py Support dicts in inventory vars. 2012-04-19 09:40:17 +02:00
playbook.py Make it possible to use facts from hosts in templates for other hosts. 2012-04-21 12:45:37 -04:00
runner.py Make it possible to use facts from hosts in templates for other hosts. 2012-04-21 12:45:37 -04:00
utils.py Make it possible to use facts from hosts in templates for other hosts. 2012-04-21 12:45:37 -04:00