diff --git a/roles/educontainer/tasks/setup.yml b/roles/educontainer/tasks/setup.yml index e3d1517..37dfca0 100644 --- a/roles/educontainer/tasks/setup.yml +++ b/roles/educontainer/tasks/setup.yml @@ -38,13 +38,19 @@ path: /var/lib/machines/{{ contname }}00/etc/profile line: 'export LANG=C' +## Use 'chroot' here instead of 'systemd-nspawn -D …' to make it work +## with ansible-pull in the preseed debian installer: - name: upgrade container command: - cmd: > - chroot . sh -c '/usr/bin/apt-get update && - DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get full-upgrade --yes' + cmd: "{{ item }}" args: chdir: /var/lib/machines/{{ contname }}00 + loop: + - mount --bind /proc proc + - mount --bind /sys sys + - mount --bind /dev/pts dev/pts + - chroot . sh -c '/usr/bin/apt-get update && DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get full-upgrade --yes' + - umount proc sys dev/pts register: cmd_result changed_when: cmd_result.stdout is not search('0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.')