# -*- mode: yaml; indent-tabs-mode: nil; tab-width: 2; coding: utf-8-unix -*- --- - name: "DEBUG: ansible-gentoo_install chroot.yml" debug: verbosity: 1 msg: "DEBUG: ansible-gentoo_install chroot.yml" - name: test we are NOT in the chroot shell: | df | grep "{{AGI_NBD_MP}}" || exit 1 [ -n "{{AGI_NBD_MP}}" ] || exit 2 [ -d "{{AGI_NBD_MP}}" ] || exit 3 [ "{{ansible_distribution}}" == 'Gentoo' ] || \ ( {{AGI_GENTOO_FROM_MP}} != '' && "{{AGI_GENTOO_FROM_MP}}" != '/' ) || \ exit 4 [ -d "{{AGI_GENTOO_FROM_MP}}" ] || exit 5 check_mode: false - name: copy resolv.conf into chroot copy: src: /etc/resolv.conf dest: "{{AGI_NBD_MP}}/etc/resolv.conf" remote_src: yes when: not ansible_check_mode - name: mount /proc in chroot mount: name: "{{AGI_NBD_MP}}/proc" src: proc fstype: proc state: mounted check_mode: false - name: bind-mount dirs in chroot mount: name: "{{AGI_NBD_MP}}/{{ item }}" src: /{{ item }} fstype: auto opts: bind state: mounted with_items: - sys - dev - dev/pts - dev/shm check_mode: false - name: chroot wrapper script template: src: chroot_wrapper.sh dest: "/var/tmp/chroot_wrapper.sh" owner: 'root' mode: '0755' check_mode: false