Adding support for acting on a local chroot

Hello

I'd like to use Ansible to configure a local chroot (ex: a deboostrap)
for easing management/generation of virtual OSes images. With respect to
'ansible chroot' all I got was issue 1097.

Taking mpdehaan suggestion of 'chroot: /path/to/chroot'[1] I've uploaded
a proof of concept[2]. There are many things missing by now (check
directoy existence, play nice with sudo, check euid == 0 for chrooting,
test more complex playbooks, etc...), I'd like to hear some feedback.

Playbook[3] I'm playing with and output of playbook run[4]. I'm able to
get facts with '-m setup' as well[5].

While doing this I got a traceback because '/proc' is not necessarily
mounted inside a chroot. There are two fixed for that in [6] and [7].

Regards,
maykel

[1] https://github.com/ansible/ansible/issues/1097#issuecomment-8888954
[2] http://git.io/CqHtaQ
[3] http://pastebin.com/PzrJFVDY
[4] http://pastebin.com/GkVjqPmc
[5] http://pastebin.com/9kn9PFJP
[6] http://git.io/sY4qmQ
[7] http://git.io/QD1rJw

If this works, I'm game.

It should probably raise an error if you try to use the chroot option
with another connection type, I think.

(Would love to see an example playbook and some basic instructions for
testing it out)

Thanks!

PR 2082 filled including both example playbook an basic instructions.

Regards,
maykel

The more I think about this, the more I wonder if 'chroot' shouldn't become a connection type itself. (connection types would need to become configurable per target to make it useful beyond just chroots)

Right, the discussion on the ticket is about doing exactly that,
making it a connection type.