Files
kubespray/roles/kubespray_defaults/vars/main/download.yml
T
Max Gautier bd20622a16 download: define utility variables (#13521)
local_release_dir has insufficient nuances, as it needs to handle
several cases,
- where to put downloaded artifacts
- where to search for when installing artifacts
- where to search for when using artifacts (passing them via lookup to
  kubectl stdin for instance)

Furthermore, depending on how the user set up download delegation, the
value we want can be on the host the tasks is executing, on the
delegated hosts, etc.

Define variables on top of local_release_dir for differents contexts,
handling which host context to use depending on `download_delegate`.

Mostly, this boils down to choosing the correct `host` for
hostvars[host]['local_release_dir'].
2026-09-17 08:59:23 +00:00

24 lines
1.2 KiB
YAML

---
## Variables used by roles/download and task installing artefacts on node
# Where ansible should look for artefacts when installing binaries / pre-loading container image
# This is subtly different from local_release_dir, because it takes into
# account `download_delegate`, and in particular the scenario where:
# - hostvars['some_host']['download_delegate'] == 'other_host' or 'localhost' -> both scenario will result in the artefact transiting by localhost
# - hostvars['localhost']['local_release_dir'] != hostvars['some_host']['local_release_dir']
# We explicitly check hostvars
install_source_dir: "{{
hostvars[
inventory_hostname if download_delegate == inventory_hostname
else 'localhost'
]['local_release_dir'] | default(default_local_release_dir)
}}"
# This always refers to the value of `local_release_dir` for localhost
# used by tasks which need to refer to paths on the controller, for instance, using lookup('file')
install_source_localhost: "{{ hostvars['localhost']['local_release_dir'] | default(default_local_release_dir) }}"
# This variable is the default for local_release_dir and is used to refer to
# the default even when `local_release_dir` is overridden by inventory
default_local_release_dir: /tmp/releases