---
- name: set_container_facts | Display the name of the image being processed
  debug:
    msg: "{{ download.repo }}"

- name: set_container_facts | Set if containers should be pulled by digest
  set_fact:
    pull_by_digest: >-
      {%- if download.sha256 is defined and download.sha256 -%}true{%- else -%}false{%- endif -%}

- name: set_container_facts | Define by what name to pull the image
  set_fact:
    image_reponame: >-
      {%- if pull_by_digest %}{{ download.repo }}@sha256:{{ download.sha256 }}{%- else -%}{{ download.repo }}:{{ download.tag }}{%- endif -%}

- name: set_container_facts | Define file name of image
  set_fact:
    image_filename: "{{ image_reponame | regex_replace('/|\0|:', '_') }}.tar"

- name: set_container_facts | Define path of image
  set_fact:
    image_path_cached: "{{ download_cache_dir }}/images/{{ image_filename }}"
    image_path_final: "{{ local_release_dir }}/images/{{ image_filename }}"
