diff --git a/tasks/lxc_cache_create.yml b/tasks/lxc_cache_create.yml index 70fb0cd1..85108de4 100644 --- a/tasks/lxc_cache_create.yml +++ b/tasks/lxc_cache_create.yml @@ -40,8 +40,6 @@ url: "{{ lxc_image_cache_server }}/{{ item.split(';')[-1] }}/meta.tar.xz" dest: "/tmp/meta.tar.xz" with_items: "{{ lxc_images }}" - when: - - item | match("^{{ cache_index_item }}") - name: Place container metadata unarchive: diff --git a/tasks/lxc_cache_preparation.yml b/tasks/lxc_cache_preparation.yml index 627b5991..733bbc8e 100644 --- a/tasks/lxc_cache_preparation.yml +++ b/tasks/lxc_cache_preparation.yml @@ -26,7 +26,14 @@ - name: Set image index fact set_fact: - lxc_images: "{{ image_index.content.splitlines() }}" + lxc_images: > + {%- set images = [] %} + {%- for image in image_index.content.splitlines() %} + {%- if image | match("^" + cache_index_item) %} + {%- set _ = images.append(image) %} + {%- endif %} + {%- endfor %} + {{- images -}} - include: "lxc_cache_preparation_systemd_{{ (systemd_version.stdout_lines[0].split()[-1] | int > 219) | ternary('new', 'old') }}.yml" diff --git a/tasks/lxc_cache_preparation_systemd_new.yml b/tasks/lxc_cache_preparation_systemd_new.yml index cddfc572..fbfcf327 100644 --- a/tasks/lxc_cache_preparation_systemd_new.yml +++ b/tasks/lxc_cache_preparation_systemd_new.yml @@ -39,5 +39,3 @@ - pull_image.rc != 0 - "'failed' in pull_image.stderr | lower" with_items: "{{ lxc_images }}" - when: - - item | match("^{{ cache_index_item }}") diff --git a/tasks/lxc_cache_preparation_systemd_old.yml b/tasks/lxc_cache_preparation_systemd_old.yml index e61159d7..b2723953 100644 --- a/tasks/lxc_cache_preparation_systemd_old.yml +++ b/tasks/lxc_cache_preparation_systemd_old.yml @@ -126,8 +126,6 @@ retries: 3 delay: 1 with_items: "{{ lxc_images }}" - when: - - item | match("^{{ cache_index_item }}") - name: Place container rootfs unarchive: