66408a87ee
* download file * download containers * fix push image to nodes * pull if none image on host * fix * improve docker image tag checks. do not pull already cached images * rebase fix merge conflict * add support download_run_once when upgrade and scale cluster add some test with download_run_once * set default values to temp flag for every download cycle * add save,load abilty for containerd and crio when download_run_once=true * return redefine image save/load command to set_docker_image_facts.yml * move set command to set_container_facts * ctr in containerd_bin_dir * fix order of ctr image export arguments * temporary disable download_run_once for containerd and crio due https://github.com/containerd/containerd/issues/4075 * remove unused files * fix strict yaml linter warning and errors * refactor logical conditions to pull and cache container images * remove comment due lint check * document role * remove image_load_on_localhost, because cached images are always loaded to docker on remote sites * remove XXX from debug output
64 lines
2.1 KiB
YAML
64 lines
2.1 KiB
YAML
---
|
|
- 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
|
|
template:
|
|
src: "kubeadm-images.yaml.j2"
|
|
dest: "{{ kube_config_dir }}/kubeadm-images.yaml"
|
|
when:
|
|
- not skip_kubeadm_images|default(false)
|
|
|
|
- name: prep_kubeadm_images | Copy kubeadm binary from download dir to system path
|
|
synchronize:
|
|
src: "{{ local_release_dir }}/kubeadm-{{ kubeadm_version }}-{{ image_arch }}"
|
|
dest: "{{ bin_dir }}/kubeadm"
|
|
compress: no
|
|
perms: yes
|
|
owner: no
|
|
group: no
|
|
delegate_to: "{{ inventory_hostname }}"
|
|
|
|
- name: prep_kubeadm_images | Set kubeadm binary permissions
|
|
file:
|
|
path: "{{ bin_dir }}/kubeadm"
|
|
mode: "0755"
|
|
state: file
|
|
|
|
- name: prep_kubeadm_images | Generate list of required images
|
|
shell: "{{ bin_dir }}/kubeadm config images list --config={{ kube_config_dir }}/kubeadm-images.yaml | grep -v coredns"
|
|
register: kubeadm_images_raw
|
|
run_once: true
|
|
changed_when: false
|
|
when:
|
|
- not skip_kubeadm_images|default(false)
|
|
|
|
- name: prep_kubeadm_images | Parse list of images
|
|
vars:
|
|
kubeadm_images_list: "{{ kubeadm_images_raw.stdout_lines }}"
|
|
set_fact:
|
|
kubeadm_image:
|
|
key: "kubeadm_{{ (item | regex_replace('^(?:.*\\/)*','')).split(':')[0] }}"
|
|
value:
|
|
enabled: true
|
|
container: true
|
|
repo: "{{ item | regex_replace('^(.*):.*$','\\1') }}"
|
|
tag: "{{ item | regex_replace('^.*:(.*)$','\\1') }}"
|
|
groups: k8s-cluster
|
|
loop: "{{ kubeadm_images_list | flatten(levels=1) }}"
|
|
register: kubeadm_images_cooked
|
|
run_once: true
|
|
when:
|
|
- not skip_kubeadm_images|default(false)
|
|
|
|
- name: prep_kubeadm_images | Convert list of images to dict for later use
|
|
set_fact:
|
|
kubeadm_images: "{{ kubeadm_images_cooked.results | map(attribute='ansible_facts.kubeadm_image') | list | items2dict }}"
|
|
run_once: true
|
|
when:
|
|
- not skip_kubeadm_images|default(false)
|