ansible/ansible — pull request #2106 by mmoya (2013-02-17 03:23:40+00:00)
Title: Local chroot support v2

Add support for acting on a local chroot. This could be used for building a preconfigured virtual OS image starting from a raw distro bootstrap.

Requires running ansible as `root`.

Includes two fixes for fails when `/proc` is not mounted.

Using
-----

Example of use with a Debian boostrap:

$ sudo deboostrap squeeze /tmp/squeeze-chroot
$ sudo chroot /tmp/squeeze-chroot apt-get update
$ sudo chroot /tmp/squeeze-chroot apt-get -V --no-install-recommends install python python-apt
$ sudo -E ansible-playbook -vvv -c chroot -i '/tmp/squeeze-chroot,' all -m setup
$ sudo -E ansible-playbook -vvv -c chroot -i '/tmp/squeeze-chroot,' test-playbook.yml

an example `test-playbook.yml` could be:

---
- hosts: all
tasks:
- name: echo something to temp
shell: "echo Yaaayy!" >/tmp/foobar.txt

- name: installs a package
apt: pkg=less state=latest

Notes
-----
Same as #2082 but now `chroot` is an independent connection type as suggested.