From 9e2a6a70e3e478971dcb1e2e7465ef0c81a367bc Mon Sep 17 00:00:00 2001
From: "Andreas B. Mundt" <andi@debian.org>
Date: Wed, 16 Mar 2022 15:22:17 +0100
Subject: [PATCH] Fix warning about missing pseudo file systems.

---
 roles/educontainer/tasks/setup.yml | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

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.')