- name: "Download Base OS"
  get_url:
    url: "{{ base_rootfs_tarball_url }}"
    dest: "{{ base_rootfs_tarball_file }}"
    checksum: "sha1:{{ base_rootfs_sha1 }}"

- name: Unmount sys, dev, proc from chroot
  mount:
    path: "{{ loop_mount_location }}{{ item }}"
    state: absent
    src: "{{item}}"
    opts: bind
    fstype: auto
  with_items:
    - "/dev"
    - "/proc"
    - "/sys"
    - "/run"

- name: Remove existing content
  shell: "rm -rf {{ loop_mount_location }}/*"
  become: yes

- name: "Extract Base OS Archive"
  unarchive:
    src: "{{ base_rootfs_tarball_file }}"
    dest: "{{ loop_mount_location }}"
  become: yes
