Install specific K8s version
This commit is contained in:
parent
ddc2730fc3
commit
5db5bbbb4d
|
@ -9,8 +9,9 @@
|
|||
- curl
|
||||
ansible.builtin.apt:
|
||||
name: "{{ packages }}"
|
||||
state: present
|
||||
state: latest
|
||||
update_cache: yes
|
||||
cache_valid_time: 3600
|
||||
|
||||
- name: Setup Kubernetes repository
|
||||
become: true
|
||||
|
@ -25,19 +26,29 @@
|
|||
repo: deb [signed-by=/etc/apt/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main
|
||||
state: present
|
||||
|
||||
- name: Update apt cache
|
||||
ansible.builtin.apt:
|
||||
update_cache: yes
|
||||
|
||||
- name: Get Kubernetes package version
|
||||
ansible.builtin.shell: "apt-cache show kubeadm | grep -F 'Version: {{ k8s_version }}.' | cut -d' ' -f2 | sort -n | tail -n 1"
|
||||
register: k8s_pkg_ver
|
||||
|
||||
- name: Setup Kubernetes packages
|
||||
become: true
|
||||
vars:
|
||||
packages:
|
||||
- kubelet
|
||||
- kubeadm
|
||||
- kubectl
|
||||
- kubelet={{ k8s_pkg_ver.stdout }}
|
||||
- kubeadm={{ k8s_pkg_ver.stdout }}
|
||||
- kubectl={{ k8s_pkg_ver.stdout }}
|
||||
block:
|
||||
- name: Install kubelet, kubeadm and kubectl
|
||||
ansible.builtin.apt:
|
||||
name: "{{ packages }}"
|
||||
state: present
|
||||
update_cache: yes
|
||||
allow_downgrade: no
|
||||
cache_valid_time: 3600
|
||||
|
||||
- name: Hold Kubernetes packages
|
||||
loop: "{{ packages }}"
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
name: "{{ packages }}"
|
||||
state: present
|
||||
update_cache: yes
|
||||
cache_valid_time: 3600
|
||||
|
||||
- name: Install Kubernetes module dependencies
|
||||
ansible.builtin.pip:
|
||||
|
|
Loading…
Reference in New Issue