mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-10-29 22:03:22 -02:30
downloads: pre-filter the loop instead of using when (#13563)
This prevent evaluation of the whole item even if not used, and the tasks scheduling of skipped tasks. Preventing evaluation in particular helps avoiding irrelevant errors, like when an unused downloads member has undefined members.
This commit is contained in:
@@ -18,13 +18,15 @@
|
||||
|
||||
- name: Download | Download files / images
|
||||
include_tasks: "{{ include_file }}"
|
||||
loop: "{{ downloads | combine(kubeadm_images) | dict2items }}"
|
||||
loop: "{{ [] if skip_downloads
|
||||
else (
|
||||
(downloads | combine(kubeadm_images)).values()
|
||||
| selectattr('enabled')
|
||||
)
|
||||
}}"
|
||||
vars:
|
||||
download: "{{ download_defaults | combine(item.value) }}"
|
||||
download: "{{ download_defaults | combine(item) }}"
|
||||
include_file: "download_{% if download.container %}container{% else %}file{% endif %}.yml"
|
||||
when:
|
||||
- not skip_downloads
|
||||
- download.enabled
|
||||
- item.value.enabled
|
||||
- (not download.container) or (download.container and download_container)
|
||||
- (download_run_once and inventory_hostname == download_delegate) or (group_names | intersect(download.groups) != [])
|
||||
|
||||
Reference in New Issue
Block a user