Filter lxc_images list per host

To greatly reduce the amount of log noise from skipped tasks, when
setting the 'lxc_images' var filter it to only include items that begin
with the 'cache_index_item' var. The when clauses in tasks that looped
through 'lxc_images' looking for this same match can be removed.

Change-Id: I4bf7b32faa9ed0a8cddeb0792f912c0100dbece8
This commit is contained in:
Jimmy McCrory 2017-04-19 12:14:52 -07:00
parent c6dda21cbc
commit 79eb16e44d
4 changed files with 8 additions and 7 deletions

View File

@ -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:

View File

@ -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"

View File

@ -39,5 +39,3 @@
- pull_image.rc != 0
- "'failed' in pull_image.stderr | lower"
with_items: "{{ lxc_images }}"
when:
- item | match("^{{ cache_index_item }}")

View File

@ -126,8 +126,6 @@
retries: 3
delay: 1
with_items: "{{ lxc_images }}"
when:
- item | match("^{{ cache_index_item }}")
- name: Place container rootfs
unarchive: