ansible/ansible — pull request #1847 by silviud (2013-01-09 20:08:38+00:00)
Title: local sudo and password

Ability to access on local machine files/directories owned exclusive by root via sudo.

This is the implementation of a missing feature - from the file comments I understand
was low priority but I need it (especially on ubuntu).

I run all test cases and this is my test
```shell
$ cat sudo_with_password.yaml
---
- hosts: web
user: silviud
sudo: True
vars:
app_src: /home/silviud/ansible
app_dst: /root
app_archive_name: ansible.tgz
tasks:
- name: prepare web app
action: command tar cvfz "$app_dst/$app_archive_name" --exclude-vcs $app_src
delegate_to: localhost

$ cat ~/.ansible/hosts
[web]
127.0.0.1
$ sudo -k
$ ansible-playbook -vvv sudo_with_password.yaml -K -k -i ~/.ansible/hosts
$ sudo ls ~root/ansible.tgz
[sudo] password for silviud:
/root/ansible.tgz
```

For implementation there may be a different way to write the Popen.stdin object (as with a second process chaining the stdout to stdin) but I find that adds complexity for no reason and in a way is less secure as you would need to do something like echo 'password' | sudo -S ... - this will show up into the ps table.