---
# These roles do not get run as a full playbook, they are all called independently
# via their tag.

# This role should be run during both local builds and remote builds, before extraction.
- name: Clear build metadata
  hosts: ai:vision:operator_group:simulator_group:logplay_group
  roles:
    - { role: "clear_build_metadata", tags: ["clear_build_metadata", "local_build_extraction", "build_cache_extract"] }

- name: Build Cache - Pre-Extraction
  hosts: ai:vision:operator_group:simulator_group:logplay_group
  roles:
    - { role: "build_cache_pre_extract", tags: ["build_cache_pre_extract"] }

- name: Build Cache - Extraction
  hosts: ai:vision:operator_group:simulator_group:logplay_group
  roles:
    - { role: "build_cache_extract", tags: ["build_cache_extract"] }

- name: Build Cache - Post-Extraction
  hosts: ai:vision:operator_group:simulator_group:logplay_group
  roles:
    - { role: "build_cache_post_extract", tags: ["build_cache_post_extract"] }

- name: Local Build
  hosts: ai
  roles:
    - { role: "local_build", tags: ["local_build"] }

- name: Local Build Extraction
  hosts: ai
  roles:
    - { role: "local_build_extraction", tags: ["local_build_extraction"] }

# This role should be run after extraction for both local builds and remote builds.
# It is invoked separately at the end of deploy, after all modifications to /opt/zoox/ai/.
- name: Write build metadata
  hosts: ai:vision:operator_group:simulator_group:logplay_group
  roles:
    - { role: "write_build_metadata", tags: ["write_build_metadata"] }
