From 6c954df636e84aff57a13f531ff479e44fdbc5d5 Mon Sep 17 00:00:00 2001 From: Atoms Date: Wed, 11 Apr 2018 12:05:33 +0300 Subject: [PATCH 1/2] move when condition to main.yml --- roles/download/tasks/main.yml | 1 + roles/download/tasks/sync_container.yml | 12 ++---------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/roles/download/tasks/main.yml b/roles/download/tasks/main.yml index c6e910e5d..2474b4029 100644 --- a/roles/download/tasks/main.yml +++ b/roles/download/tasks/main.yml @@ -22,3 +22,4 @@ - item.value.enabled - item.value.container - download_run_once + - group_names | intersect(download.groups) | length diff --git a/roles/download/tasks/sync_container.yml b/roles/download/tasks/sync_container.yml index 1ca84ad67..c7e37d7f3 100644 --- a/roles/download/tasks/sync_container.yml +++ b/roles/download/tasks/sync_container.yml @@ -7,7 +7,6 @@ when: - download.enabled - download.container - - group_names | intersect(download.groups) | length tags: - facts @@ -18,7 +17,7 @@ - download.enabled - download.container - download_run_once - - group_names | intersect(download.groups) | length + tags: - facts @@ -29,7 +28,6 @@ - download.enabled - download.container - download_run_once - - group_names | intersect(download.groups) | length - name: "container_download | Update the 'container_changed' fact" set_fact: @@ -39,14 +37,13 @@ - download.container - download_run_once - pull_required|default(download_always_pull) - - group_names | intersect(download.groups) | length run_once: "{{ download_run_once }}" tags: - facts - name: container_download | Stat saved container image stat: - path: "{{fname}}" + path: "{{ fname }}" register: img changed_when: false delegate_to: "{{ download_delegate }}" @@ -57,7 +54,6 @@ - download.enabled - download.container - download_run_once - - group_names | intersect(download.groups) | length tags: - facts @@ -73,7 +69,6 @@ - download_run_once - (ansible_os_family not in ["CoreOS", "Container Linux by CoreOS"] or download_delegate == "localhost") - (container_changed or not img.stat.exists) - - group_names | intersect(download.groups) | length - name: container_download | copy container images to ansible host synchronize: @@ -93,7 +88,6 @@ - inventory_hostname == download_delegate - download_delegate != "localhost" - saved.changed - - group_names | intersect(download.groups) | length - name: container_download | upload container images to nodes synchronize: @@ -115,7 +109,6 @@ - (ansible_os_family not in ["CoreOS", "Container Linux by CoreOS"] and inventory_hostname != download_delegate or download_delegate == "localhost") - - group_names | intersect(download.groups) | length tags: - upload - upgrade @@ -128,7 +121,6 @@ - download_run_once - (ansible_os_family not in ["CoreOS", "Container Linux by CoreOS"] and inventory_hostname != download_delegate or download_delegate == "localhost") - - group_names | intersect(download.groups) | length tags: - upload - upgrade From 61791bbb3d0622507ce96593d5f082d26f2c24e5 Mon Sep 17 00:00:00 2001 From: Matthew Mosesohn Date: Thu, 12 Apr 2018 14:29:34 +0300 Subject: [PATCH 2/2] Remove condition for docker pull when using download delegate --- roles/download/tasks/download_container.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/roles/download/tasks/download_container.yml b/roles/download/tasks/download_container.yml index a5659619c..7e3923606 100644 --- a/roles/download/tasks/download_container.yml +++ b/roles/download/tasks/download_container.yml @@ -2,12 +2,11 @@ - name: container_download | Make download decision if pull is required by tag or sha256 include_tasks: set_docker_image_facts.yml delegate_to: "{{ download_delegate if download_run_once or omit }}" - delegate_facts: no + delegate_facts: yes run_once: "{{ download_run_once }}" when: - download.enabled - download.container - - group_names | intersect(download.groups) | length tags: - facts @@ -24,7 +23,6 @@ - download.enabled - download.container - pull_required|default(download_always_pull) - - group_names | intersect(download.groups) | length delegate_to: "{{ download_delegate }}" delegate_facts: yes run_once: yes