check if image command tool is installed before building up a cache

pull/11202/head
Payback159 2024-10-12 13:46:19 +02:00
parent d509ef65ae
commit 36d226a8e1
1 changed files with 30 additions and 16 deletions

View File

@ -16,22 +16,36 @@
- download
- upload
- name: Download | Generate a list of information about the images on a node
- name: Download | Check if image command tool exists
command: "{{ image_command_tool }} --version"
register: image_command_tool_exists
changed_when: false
failed_when: false
- name: Download | Check if image command tool exists
stat:
path: "{{ bin_dir }}/{{ image_command_tool }}"
get_attributes: false
get_checksum: false
get_mime: false
register: image_command_tool_exists
changed_when: false
- name: Download | Process and download required files and images
when:
- not (download_always_pull or skip_downloads) | default(false)
- image_command_tool_exists.stat.exists
block:
- name: Download | Get image list from node
command: "{{ image_info_command }}"
register: node_images_raw
changed_when: false
check_mode: false
when:
- not (download_always_pull or skip_downloads) | default(false)
- name: Download | Set node_images
include_tasks: "{{ include_file }}"
vars:
include_file: "set_node_facts{% if image_command_tool == 'crictl' %}_crictl{% else %}{% endif %}.yml"
when:
- not (download_always_pull or skip_downloads) | default(false)
- name: Show node images
- name: Download | Show node images
debug:
msg: "{{ node_images }}"
@ -68,6 +82,6 @@
)
- (download_run_once and inventory_hostname == download_delegate) or (group_names | intersect(download.groups) | length)
- name: Show downloads
- name: Download | Show downloads
debug:
msg: "{{ downloads }}"