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