---
- block:
  - name: Unmount sys, dev, proc from chroot
    command: "umount {{ chroot_mount_point }}{{ item }}"
    with_items:
      - "/tmp"
      - "/run"
      - "/sys"
      - "/proc"
      - "/dev"

  - name: Unmount devices
    command: "umount {{ item }}"
    with_items:
      - "{{ chroot_mount_point }}"
      - "{{ lower_loop_mount_location }}"
      - "{{ loop_mount_location }}"

  - name: Remove mount points
    command: "rmdir {{ item }}"
    with_items:
      - "{{ lower_loop_mount_location }}"
      - "{{ loop_mount_location }}"
      - "{{ chroot_mount_point }}"

  become: yes
