2018-12-28 07:27:27 +00:00
|
|
|
---
|
2019-05-01 08:10:56 +00:00
|
|
|
- name: kubeadm | Download kubeadm
|
|
|
|
include_tasks: "download_file.yml"
|
|
|
|
vars:
|
|
|
|
download: "{{ download_defaults | combine(downloads.kubeadm) }}"
|
|
|
|
when:
|
|
|
|
- not skip_downloads|default(false)
|
|
|
|
- downloads.kubeadm.enabled
|
|
|
|
|
|
|
|
- name: kubeadm | Sync kubeadm
|
|
|
|
include_tasks: "sync_file.yml"
|
|
|
|
vars:
|
|
|
|
download: "{{ download_defaults | combine(downloads.kubeadm) }}"
|
|
|
|
when:
|
|
|
|
- not skip_downloads|default(false)
|
|
|
|
- downloads.kubeadm.enabled
|
|
|
|
- download_run_once
|
|
|
|
- group_names | intersect(download.groups) | length
|
|
|
|
|
2018-12-19 13:17:58 +00:00
|
|
|
- name: kubeadm | Create kubeadm config
|
|
|
|
template:
|
|
|
|
src: "kubeadm-images.yaml.j2"
|
|
|
|
dest: "{{ kube_config_dir }}/kubeadm-images.yaml"
|
|
|
|
|
2019-01-28 10:00:49 +00:00
|
|
|
- name: kubeadm | Copy kubeadm binary from download dir
|
|
|
|
synchronize:
|
2019-05-01 08:10:56 +00:00
|
|
|
src: "{{ local_release_dir }}/kubeadm-{{ kubeadm_version }}-{{ image_arch }}"
|
2019-01-28 10:00:49 +00:00
|
|
|
dest: "{{ bin_dir }}/kubeadm"
|
|
|
|
compress: no
|
|
|
|
perms: yes
|
|
|
|
owner: no
|
|
|
|
group: no
|
|
|
|
delegate_to: "{{ inventory_hostname }}"
|
|
|
|
|
|
|
|
- name: kubeadm | Set kubeadm binary permissions
|
|
|
|
file:
|
|
|
|
path: "{{ bin_dir }}/kubeadm"
|
|
|
|
mode: "0755"
|
|
|
|
state: file
|
|
|
|
|
2018-12-19 13:17:58 +00:00
|
|
|
- name: container_download | download images for kubeadm config images
|
2019-01-28 10:00:49 +00:00
|
|
|
command: "{{ bin_dir }}/kubeadm config images pull --config={{ kube_config_dir }}/kubeadm-images.yaml"
|
2019-05-01 08:10:56 +00:00
|
|
|
when: not download_run_once
|
|
|
|
|
|
|
|
- name: container_download | fetch list of kubeadm config images
|
|
|
|
command: "{{ bin_dir }}/kubeadm config images list --config={{ kube_config_dir }}/kubeadm-images.yaml"
|
|
|
|
register: result
|
|
|
|
run_once: true
|
|
|
|
when: download_run_once
|
|
|
|
changed_when: false
|
|
|
|
|
2019-05-16 07:27:43 +00:00
|
|
|
- name: container_download | extract container names from list of kubeadm config images
|
|
|
|
vars:
|
2019-05-01 08:10:56 +00:00
|
|
|
kubeadm_images_list: "{{ result.stdout_lines }}"
|
|
|
|
set_fact:
|
|
|
|
kubeadm_image:
|
|
|
|
key: "kubeadm_{{ (item | regex_replace('^(?:.*\\/)*','')).split(':')[0] }}"
|
|
|
|
value:
|
|
|
|
enabled: true
|
|
|
|
container: true
|
|
|
|
repo: "{{ item.split(':')[0] }}"
|
|
|
|
tag: "{{ item.split(':')[1] }}"
|
|
|
|
groups:
|
|
|
|
- k8s-cluster
|
|
|
|
loop: "{{ kubeadm_images_list | flatten(levels=1) }}"
|
|
|
|
run_once: true
|
|
|
|
when: download_run_once
|
|
|
|
register: result_images
|
|
|
|
|
2019-05-16 07:27:43 +00:00
|
|
|
- name: container_download | set kubeadm_images
|
|
|
|
set_fact:
|
2019-05-01 08:10:56 +00:00
|
|
|
kubeadm_images: "{{ result_images.results | map(attribute='ansible_facts.kubeadm_image') | list | items2dict }}"
|
|
|
|
run_once: true
|
|
|
|
when: download_run_once
|