# Hosts:
# * build_host uses a local shell and is run for all build variants
# * chroot uses chroot into the target rootfs for all build variants
# * ai, vision, and operator also use chroot but only run for their particular build variants

---
- name: Create and mount loop device
  hosts: build_host:&ahmo_golden_image
  vars_files:
    - ../vars/ahmo_golden_image.yml
  tags:
    - create_and_mount_loop
  roles:
    - { role: create_loop_device, tags: create_loop_device }
    - { role: mount_overlay, tags: mount_overlay }

- name: Create AHMO golden image deploy layer
  hosts: chroot:live:&ahmo_golden_image
  vars_files:
    - ../vars/ahmo_golden_image.yml
  roles:
    - { role: ahmo_golden_image, tags: ahmo_golden_image }
    - { role: zoox_os_build_metadata, asset_type: ahmo_golden_image, tags: zoox_os_build_metadata, when: not is_live_update }  # no live updates because this file represents the state of the OS layer.

- name: Unmount and gzip image
  hosts: build_host:&ahmo_golden_image
  vars_files:
    - ../vars/ahmo_golden_image.yml
  tags:
    - unmount_and_gzip
  roles:
    - { role: unmount_overlay, tags: unmount_overlay }
    - { role: gzip_image, tags: gzip_image }
