From 13f225e6ae31024bb2f422657e9461142df11677 Mon Sep 17 00:00:00 2001 From: Timoses Date: Thu, 16 May 2019 09:25:49 +0200 Subject: [PATCH] Only pull images for destined host groups (#4735) Without this, pulls are considered for all hosts groups, even if not targetted by the downloads `groups` list. Hence, a download/sync is triggered even though the host does not require the image. --- roles/download/tasks/set_docker_image_facts.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/roles/download/tasks/set_docker_image_facts.yml b/roles/download/tasks/set_docker_image_facts.yml index 6fb00e5c0..72d898df1 100644 --- a/roles/download/tasks/set_docker_image_facts.yml +++ b/roles/download/tasks/set_docker_image_facts.yml @@ -15,12 +15,16 @@ failed_when: false changed_when: false check_mode: no - when: not download_always_pull + when: + - not download_always_pull + - group_names | intersect(download.groups) | length - set_fact: pull_required: >- {%- if pull_args in docker_images.stdout.split(',') %}false{%- else -%}true{%- endif -%} - when: not download_always_pull + when: + - not download_always_pull + - group_names | intersect(download.groups) | length - name: Does any host require container pull? vars: @@ -35,6 +39,7 @@ assert: that: "{{ download.repo }}:{{ download.tag }} in docker_images.stdout.split(',')" when: + - group_names | intersect(download.groups) | length - not download_always_pull - not pull_required - pull_by_digest