diff --git a/lib/ansible/plugins/connection/chroot.py b/lib/ansible/plugins/connection/chroot.py index 65c37a0841..d9f499a11c 100644 --- a/lib/ansible/plugins/connection/chroot.py +++ b/lib/ansible/plugins/connection/chroot.py @@ -63,7 +63,11 @@ class Connection(ConnectionBase): raise AnsibleError("%s is not a directory" % self.chroot) chrootsh = os.path.join(self.chroot, 'bin/sh') - if not is_executable(chrootsh): + # Want to check for a usable bourne shell inside the chroot. + # is_executable() == True is sufficient. For symlinks it + # gets really complicated really fast. So we punt on finding that + # out. As long as it's a symlink we assume that it will work + if not (is_executable(chrootsh) or (os.path.lexists(chrootsh) and os.path.islink(chrootsh))): raise AnsibleError("%s does not look like a chrootable dir (/bin/sh missing)" % self.chroot) self.chroot_cmd = distutils.spawn.find_executable('chroot')