Skip to content

Commit

Permalink
Delegate prep_kubeadm_images to control plane
Browse files Browse the repository at this point in the history
Doing this instead of checking for host membership prevent breaking for
cases where we don't run on control plane (--limit <nodes> for instance,
when scaling).
import_tasks is more approriate, since the tasks are not dynamic and we
always run them (mostly).
  • Loading branch information
VannTen committed Feb 24, 2024
1 parent 26034b2 commit c8e343a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
5 changes: 3 additions & 2 deletions roles/download/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
- upload

- name: Download | Get kubeadm binary and list of required images
include_tasks: prep_kubeadm_images.yml
import_tasks: prep_kubeadm_images.yml
run_once: true
delegate_to: "{{ groups['kube_control_plane'][0] }}"
when:
- not skip_downloads
- inventory_hostname in groups['kube_control_plane']
tags:
- download
- upload
Expand Down
3 changes: 0 additions & 3 deletions roles/download/tasks/prep_kubeadm_images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@
fail:
msg: "Kubeadm version {{ kubeadm_version }} do not matches kubernetes {{ kube_version }}"
when:
- not skip_downloads | default(false)
- not kubeadm_version == downloads.kubeadm.version

- name: Prep_kubeadm_images | Download kubeadm binary
include_tasks: "download_file.yml"
vars:
download: "{{ download_defaults | combine(downloads.kubeadm) }}"
when:
- not skip_downloads | default(false)
- downloads.kubeadm.enabled

- name: Prep_kubeadm_images | Create kubeadm config
Expand All @@ -38,7 +36,6 @@
- name: Prep_kubeadm_images | Generate list of required images
command: "{{ bin_dir }}/kubeadm config images list --config={{ kube_config_dir }}/kubeadm-images.yaml"
register: kubeadm_images_raw
run_once: true
changed_when: false
when:
- not skip_kubeadm_images

0 comments on commit c8e343a

Please sign in to comment.