Only allocate a PTY when sudo is used

Postpone the paramiko.Channel.get_pty until we know sudo is used. If
sudo is not used, then we do not need a PTY. In fact, the paramiko docs
explicitly state that it's not desirable to allocate a PTY for a simple
exec_command.

Signed-off-by: martin f. krafft <madduck@madduck.net>
Initialise PTY from calling environment

If we need to acquire a PTY for sudo's use, then it should really
inherit the capabilities of the calling environment. This is what
OpenSSH does, and so it makes sense to copy this behaviour for the
paramiko connection type.

Closes: #2065
Signed-off-by: martin f. krafft <madduck@madduck.net>
Add support for additional EXAMPLES string in Ansible modules
return DOC and EXAMPLES as a list
add moduledev explanation
more
Removes exception is sysctl file is missing

When syscl file was missing, sysctl module was complaining about it and
bailing out.
This behaviour prevents usage of /etc/sysctl.d directory, present in
some distributions.
This patch accepts a missing sysctl.conf file so sysctl.d directory can
be used.
However, it will bail out if the destination directory doesn't exist.
Changed when new sysctl file is created

When destination sysctl file is missing, it is created.
But, for idempotency purposes, the creation process now takes place just before it is used, in the
main code path so an empty file is not left over if the code
module.fail_jsons before the file is really used.
Removes useless empty string write

It s not necessary to write an empty string for the file to be created.
Add force= and make thirsty= an alias for backward compatibility
Prevent traceback when /etc/mtab is not available

* get_file_contents returns None when file is not available.
  When /etc/mtab is pointing to /proc/mounts and /proc is not
  mounted, mtab.split will traceback.
Check presence of files under /proc before opening them
Add support for running modules chrooted in a local dir

Adds 'chroot' connection for executing modules chrooted to
a local dir. Requires running ansible as root.

chroot dirs should be specified in the inventory like any
other host.

You can do things like:

$ sudo -E ansible -vvv -f 1 "./chroot1,./chroot2" -c chroot \
  all -m setup
$ sudo -E ansible-playbook -vvv -f 1 -i "./chroot1,./chroot2" \
  -c chroot some-playbook.yml

some-playbook.yml:
---
- hosts: all
  tasks:
    - name: echo something
      shell: echo "Yaaay!" >/tmp/foobar.txt
    - name: install less
      apt: pkg=less state=latest
Merge branch 'paramiko-termcap' of git://github.com/madduck/ansible into testing
Merge branch 'local-chroot-support-v2' of git://github.com/mmoya/ansible into testing
Fix comment in chroot connection type
Merge pull request #2120 from jpmens/doc_ex1

Add support for additional EXAMPLES string in Ansible modules
Show how to use the more simplified way of including EXAMPLES in docs.  We should update
all module docs to do this.
Fix version_added for insertbefore in lineinfile
Merge pull request #2145 from leucos/sysctl_no_file_check

Better sysctl module file check
Merge pull request #2146 from dagwieers/thirsty-force

Add force= and make thirsty= an alias for backward compatibility